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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamically Switch Measure within Chart

Hello

 

I am trying to create something like the formula pic below to dynamically switch a measure in a chart. 

I have everything except I am struggling to understand how to caculate the purple part below. I am not calculating anything-  All I want to achive is when I select something on the slicer, it changes the measure I want to use.  So If I select "Total Sales" if references a measure I have.  I beleive I need to just create a new measure referencing the measures I want to use- But becuase I am not doing a calcuation, I dont know what syntax to use. 

 

BretPinkerton_0-1593806208035.png

 

My use case is 

 

I have three items in a table.

Product

Package

Customer

 

I want the user to be able to select a slicer value and then the table updates dynamically with the Dynamical Measure where it pulls in the Meausre for Product, Package, or Customer. 

 

Dyanmic MeasureYTD VolumePYTD VolumeDiff
    
    
    
    

 

Thanks for anyones input

New To Power BI

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @Anonymous   ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

Currently, it is unsupported to create dynamic column based on slicer using a measure. As a workaround, you may enter into Query Editor, select on the column [Product], [Package] and [Customer] at the same time, right click to choose option "Unpivot columns".

 

You may rename the new resulted column Attribute with "SelectedColumn", click button "Close & Apply".

 

Then you may put the [SelectedColumn] which contains names of Product, Package and Customer into Slicer as filter options.

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

Please see this article.  It exactly describes what you are trying to do.  You will end up with an expression like this (copied from that link).

https://www.fourmoo.com/2017/11/21/power-bi-using-a-slicer-to-show-different-measures/

 

Selected Measure =

VAR MySelection =

SELECTEDVALUE ( ‘Measure Selection'[Measure Name], “Sales” )

RETURN

SWITCH (

TRUE (),

MySelection “Sales”, [Sales],

MySelection “Costs”, [Costs],

MySelection = “Margin”, [Margin],

[Sales]

)

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

In the example you sent me.   

 

I would like to dynamically replace the Date column with Product or Package and leave the other values constant.  

Anonymous
Not applicable

Where I am struggling is creating the measure.

 

All the examples I have found are like the one you sent me.  Where someone write  Sales= SUM(Sales). 

 

I have a Measure called "Product".  I just want to list all the products. So the SUM syntax doesnt work for me.  I am trying to understand what Syntax I need to use to create the new Product Measure that will then allow me to write the expression. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.