Skip to content

[TASK] ✨ Add Percentage Calculation Utility #1

@EricSoder

Description

@EricSoder

✨ Add Percentage Calculation Utility

📄 Description

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. 📈

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions