cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SHDJason Regular Visitor
Regular Visitor

How to display different measures using a selector

Hi. I could not find the answer to this in other places, so I'll ask it here.  

 

I would like to create a selector that will render different measures on the same chart.

 

For instance, I have a trend chart that shows users over time. I'd like to have a selector on the side so people can switch between users and transactions and revenue and have the same chart render that measure.  

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Phil_Seamark Super Contributor
Super Contributor

Re: How to display different measures using a selector

I've managed to acheive this using a measure table.

 

Download the following PBIX file

 

https://1drv.ms/u/s!AtDlC2rep7a-jkiRG_LyHcv0RSXI

 

You'll notice on the 2nd page called 'All Sorts' you can choose different Measure names from the box in the top left and it works.

 

I create a static table called [Dynamic] that carries measures and then reference them in a calculated measure on the fly

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

16 REPLIES 16
dkay84_PowerBI New Contributor
New Contributor

Re: How to display different measures using a selector

You need to do the following:

 

1. Create a table called "Measures" with 2 columns

  • Column 1 = MeasureName
  • Column 2 = MeasureID

You will fill up column 1 with the names of the measures you wish to show (i.e. transactions, revenue, etc.)

Column 2 is just an index (1,2,3,etc.)

 

MeasureName  |  MeasureID

Transactions      |          1

Revenue            |          2

etc.

 

2. Create a measure with the following syntax:

 

DisplayMeasure = SWITCH( TRUE(), MIN ( Measures[MeasureID] ) = 1, [Transactions Measure], MIN ( Measures[MeasureID ) = 2, [Revenue Measure] )

 

Expand this as neccessary.

 

Now create a slicer with Measure table column MeasureName .

 

In the chart or table , use the measure DisplayMeasure as your values field, and when you select the slicer, the chart will display the appropriate measure.

Sean Super Contributor
Super Contributor

Re: How to display different measures using a selector

Phil_Seamark Super Contributor
Super Contributor

Re: How to display different measures using a selector

I've managed to acheive this using a measure table.

 

Download the following PBIX file

 

https://1drv.ms/u/s!AtDlC2rep7a-jkiRG_LyHcv0RSXI

 

You'll notice on the 2nd page called 'All Sorts' you can choose different Measure names from the box in the top left and it works.

 

I create a static table called [Dynamic] that carries measures and then reference them in a calculated measure on the fly

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

v-ljerr-msft Super Contributor
Super Contributor

Re: How to display different measures using a selector

Hi @SHDJason,

 

Based on my testing, the solution provided above should work in your scenario. Have you tried them? If you still have any question feel free to post here.Smiley Happy

 

In addition, if the solution works, could you accept the corresponding reply as solution to help others who may have similar issue easily find the answer and close this thread?

 

Regards

SHDJason Regular Visitor
Regular Visitor

Re: How to display different measures using a selector

sorry, i haven't had a chance to test the solution yet. I'll close it as soon as i do. should be this week.

SHDJason Regular Visitor
Regular Visitor

Re: How to display different measures using a selector

This worked great. Thanks for sharing!

arthurgasparini Frequent Visitor
Frequent Visitor

Re: How to display different measures using a selector

This is perfect. Worked just fine.

jkenne01 Frequent Visitor
Frequent Visitor

Re: How to display different measures using a selector

Hi,

 

An addtional issue I have is that the 2 measures I am toggling need to display in different formats. 1 to 1 decimal place and the other to 4 decimal places. This solution works for me apart from being able to dynamically be able to set the format of the measure returned.

 

Does anyone know if this is possible?,

 

Thanks in advance for your help,

 

Cheers,

Jack

 

Highlighted
dkay84_PowerBI New Contributor
New Contributor

Re: How to display different measures using a selector

Google: “Dax format”

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 359 members 3,430 guests
Please welcome our newest community members: