Forum Discussion

rconcil's avatar
rconcil
Frequent Visitor
3 years ago
Solved

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

  1. I created a custom measure custom-Employee-Count in my FACTHEADCOUNTCONTRACT table, that count the active employees other the years.
  2. My table FACTHEADCOUNTCONTRACT is linked to my EMPLOYEES table with the EMPLOYEEKEY field.
  3. 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 🤝

4 Replies