Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
codebrane
Frequent Visitor

Alternative to multiple measures for totals

I seem to be creating lots and lots of simple measures along the lines of:

 

_total_of_this = CALCULATE(COUNT('The Table'[Something]),VALUE('The Table'[Something]) > 0)

 

across more than 30 fields to get totals for bar graphs. I was wondering if there's a more efficient way to do this, other than multiple measures that differ only in the column they work on?

 

Also, I prefix them with _ so they bubble to the top and keep separate from fields as there doesn't appear to be way to organise anything in power bi desktop. I've used powershell to create them in the past but that no longer works in 2.79.5768.721.

 

thanks,

 

Alistair

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @codebrane

 

Do you mean that you wanna combine multiple measures into less measures?

If so ,are these measures applied to the same column or the same value?In this case,you can use switch() function,such as  

 

MEASURE= SWITCH(SELECETEDVALUE(COLUMN 1),"A",[measure 1],"B","measure 2"...).

 

Here is a sample .pbix  you can refer to.

 

BUT if you wanna find the measures more easier, you can create a measure table with no filed inside,then move the measures to the table one by one.

Select the measure>go to the menu bar>move the measure to the measure table.

 

Annotation 2020-03-26 142429.png

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
 

 

 

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @codebrane

 

Do you mean that you wanna combine multiple measures into less measures?

If so ,are these measures applied to the same column or the same value?In this case,you can use switch() function,such as  

 

MEASURE= SWITCH(SELECETEDVALUE(COLUMN 1),"A",[measure 1],"B","measure 2"...).

 

Here is a sample .pbix  you can refer to.

 

BUT if you wanna find the measures more easier, you can create a measure table with no filed inside,then move the measures to the table one by one.

Select the measure>go to the menu bar>move the measure to the measure table.

 

Annotation 2020-03-26 142429.png

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
 

 

 

 

amitchandak
Super User
Super User

You can put a visual or page level filter for >0 and simply drag the column on visual and change aggregation to count

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

sorry, forgot to say, some of the data has 0-10, some has letters and some has true/false, all on the same bar graph. So could have:

 

_total = CALCULATE(COUNT('The Table'[Gender]),FORMAT('The Table'[Gender], "") = "M")

 

as well as 0-10 etc

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.