cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Alternative to multiple measures for totals

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
Highlighted
Super User IV
Super User IV

Re: Alternative to multiple measures for totals

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Frequent Visitor

Re: Alternative to multiple measures for totals

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

Highlighted
Community Support
Community Support

Re: Alternative to multiple measures for totals

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors