Forum Discussion
Distinct Count and count user choice
Hi,
I'm creating a report and would need to give the users the option to include or exclude sub-projects in the project count.
The data is something like:
Project Sub-project
1004
1004 001
1005
1006
If selecting to include sub-project, I would use count, the result would be 4.
If selecting no to include sub-projects, I would use count distinct, the result would be 3
I've tried creating a mesure, but I realized that a measure can't be used to filter at the report level.
Is there a way to accomplish this, other than creating a dupplicate page and assign the value as needed.
Thank you for your help
omelo ,You need to switch between two measure based on isfiltered
measure =
var _tab = summarize(Table, Table[project], Table[Project Sub-project])
return
countx(_tab, Table[project])
measure 1 = distinctcount(Table[project])
final measure = if(isfiltered (Table[Project Sub-project]), [measure], [measure1])
2 Replies
- amitchandakSuper User
omelo ,You need to switch between two measure based on isfiltered
measure =
var _tab = summarize(Table, Table[project], Table[Project Sub-project])
return
countx(_tab, Table[project])
measure 1 = distinctcount(Table[project])
final measure = if(isfiltered (Table[Project Sub-project]), [measure], [measure1])
- omeloHelper III
Hi,
I was not familiar with the switch function but thanks to your response I was able to find a video that gave me the details that I needed.
I'm including the link in case someone else is looking to do the same.
Dynamically change the information within a visual via a slicer - oxcrx34285 (powerbi.com)Again, many thanks for your response