Forum Discussion
Help with ALLSELECTED & DISTINCTCOUNT
Hi!
I have created a report that show personel data. To visualize the number of employees for each visualisation I am using a DISTINCTCOUNT measure on the unique employee identifier. My issue now is that when I filter on, for example, country, the other visualizations shows the percentage of total, and not a percantage of total only in that country.
How it looks without filter active
How it looks with a filter on Company
In the above view I would like the "Employee vs Consultants" + "Job Classifications" visuals to only show the percentage for the people in the chosen company, so that the sum is still 100%. I was hoping to achieve this with an ALLSELECTED measure, but I can't combine it with the DISTINCTCOUNT (to my knowledge), and if I only put ALLSELECTED(Employee_Identifier) the visual gives an error saying the measure is providing multiple inputs where there should only be one.
Thanks,
3 Replies
- AnonymousNot applicable
I also tried using a
CALCULATE(
DISTINCTCOUNT('TABLE'[FIELD TO AGGREGATE])
ALLSELECTED(FILTER)
)
But it returned the original result whatever i put in the filter - AnonymousNot applicable
Hi, Anonymous
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measure:
Employee Percentage = DIVIDE( DISTINCTCOUNT('Imformation'[employee]), CALCULATE( DISTINCTCOUNT('Imformation'[employee]), ALLSELECTED('Imformation') ) )If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric CommunityBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- AnonymousNot applicable
https://drive.google.com/drive/folders/1g40xEHjmjFyWMiMkeLHAyET_Kg-E1rL8?usp=sharing
I hope you can find the pbix file here with the attached sample CSV file. I didn't manage to change the source myself from the sharepoint to the offline file.You will notice when filtering on "Company" the other visuals does not show the percentage for that company only, but for the total. This is the issue.