You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a utility function to calculate percentages within the PowerBI JavaScript library. This utility will streamline scenarios where percentage calculations are needed, such as:
📊 Rendering percentage-based visualizations.
⏳ Displaying progress indicators.
📈 Calculating relative metrics for data processing.
🛠️ Requirements
Add a function to calculate percentages based on a part and a total.
Ensure the function:
- Returns 0 if the total is 0. 🛑
- Handles edge cases gracefully. ✅
Place the function in the appropriate utilities or helper file. 📂
✅ Acceptance Criteria
🖋️ A fully implemented calculatePercentage utility function.
🧪 Comprehensive unit tests validating its functionality written in Jest.
📝 Clear and concise documentation accompanying the function.
💡 Rationale
This utility will:
🧹 Improve code reusability and readability.
🚀 Reduce redundancy in calculating percentages across the codebase.
🛡️ Ensure consistent implementation of percentage logic.
🔥 Priority
Medium
🔍 Additional Notes
Ensure the function adheres to existing code style and patterns within the repository. 🎨
Maintain clarity and simplicity to support future enhancements. 📈
Activity