Forum Discussion
Percentage calculation issue when using calculation group
Hello the community,
I have an percentage calculation issue when I try to change from absolute values to percentage values.
I used calculation group to be able to implement the switch between absolute values and percentage values.
And I think my percentage calculation is not correct in the relative calculation item, but I don't know how to fix it.
PBIX file:
Link to file: https://drive.google.com/file/d/19fffevBDRew8yCj7A5p7iIrXbfJW8vNR/view?usp=share_link
Problem explanation:
1. Absolute values with applied filter on company.
2. Now I switch the values to percentage.
ISSUE & EXPECTED VALUES:
The percentage result shows 1% for female and male when I am expecting to have 50% female and 50% male.
The percentage result shows 1% for Full time when I am expecting to have 100% for full time.
How did I implemented the solution
- I created a custom measure custom-Employee-Count in my FACTHEADCOUNTCONTRACT table, that count the active employees other the years.
- My table FACTHEADCOUNTCONTRACT is linked to my EMPLOYEES table with the EMPLOYEEKEY field.
- I used tabular editor to create the switch between absolute and percentage values:
Absolute calculationPercentage calculation
I think the issue is on my percentage calculation in the percentage calculation item when I remove the filters.
IF (
ISSELECTEDMEASURE ( [custom-Employee-Count] ),
VAR Percentage = DIVIDE(
SELECTEDMEASURE(),
CALCULATE(
SELECTEDMEASURE(),
REMOVEFILTERS()
)
)
RETURN
ROUNDUP(Percentage,2)
)
I highly appreciate you help 🤝
Instead of REMOVEFILTERS() I would use ALLSELECTED()
Did you know there is a new formatting function for measures available? That might remove the need for Tabular Editor. Measures in Power BI Desktop - Power BI | Microsoft Learn
4 Replies
- lbendlinSuper User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523- lbendlinSuper User
Instead of REMOVEFILTERS() I would use ALLSELECTED()
Did you know there is a new formatting function for measures available? That might remove the need for Tabular Editor. Measures in Power BI Desktop - Power BI | Microsoft Learn