Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Is there a way to switch from sum to count of a value in powerbi? and not on a chart level while creating the visual? but have a drop down that lets you select whether to sum up the values along a column or to count them
Solved! Go to Solution.
Hi @WilliamMunguti ,
You can do this using bookmarks or DAX, but you mentioned "not on a chart level while creating the visual", so you can only do it via DAX.
Here is my sample data:
Create another table:
And use this table to create a slicer:
Use these DAXs to create measures:
Sum = SUM('Table'[Value])
Count = COUNT('Table'[Value])
Output =
SWITCH(
SELECTEDVALUE(Slicer[Button]),
"COUNT", [Count],
"SUM", [Sum],
[Sum]
)
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-junyant-msft
Thanks for this. Let me try it out and will give you feedback
Hi @WilliamMunguti ,
You can do this using bookmarks or DAX, but you mentioned "not on a chart level while creating the visual", so you can only do it via DAX.
Here is my sample data:
Create another table:
And use this table to create a slicer:
Use these DAXs to create measures:
Sum = SUM('Table'[Value])
Count = COUNT('Table'[Value])
Output =
SWITCH(
SELECTEDVALUE(Slicer[Button]),
"COUNT", [Count],
"SUM", [Sum],
[Sum]
)
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
4 | |
2 | |
1 | |
1 |
User | Count |
---|---|
13 | |
6 | |
5 | |
3 | |
2 |