Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 @Anonymous
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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |