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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
RalphDodson
New Member

Dynamically Changing Measures from Amount to Quantity

I have 2 measures in my fact table. SalesAmount and ShippedQuantity. I would like to place the SalesAmount on a matrix and have the user click a place on the report to change the measure from SalesAmount to ShippedQuantity and back again at will. I want to avoid the need to have 2 identical matrix using different measures. I'm assuming the resolution will involve DAX.

 

After searching the web and the forums for many hours I still cannot find any reference to this simple feature.

 

 

2 REPLIES 2
Anonymous
Not applicable

@RalphDodson,

 

Use a disconnected table that contains the measure names you want to make available to the user.  This table will be what you use for the slicer.  Next, create the measures that reference the Disconnected tables and return the users selection.  This is outlined on a couple posts on my blog, bipatterns.com.

 

Two posts I'd recommend checking out: Dynamic PowerBI Reports Via DAX and Compare two Stores Based on User Selected Measure.  

 

So if my model looks like this:

Dynamic Chart Example

 

First Step:

Create the base Measures and KPI’s needed. In this example, the measures consisted of TNS (Total Net Sales), Returns, Retail Sales, Apparel Sales %, Decor Sales %, Memorabilia Sales %, etc. These are all relatively basic DAX Measures, using nothing more than Calculate, Sum, and Divide.

Step Two:

Create the disconnected tables, highlighted in red above.  These tables will consist of two columns, Position and Variable (Column or Line Variable for example).  The position column serves as a row index, while the Variable column will contain the names of the measures you want to use dynamically.

Step Three:

Create the measures that reference the Disconnected tables.

Line Measures:

Selected Line Measure Position

SelectedLinePosition =
MIN ( Line[Position] )

 

SelectedLineMeasure =
SWITCH (
    [SelectedLinePosition],
    1, [Apparel Sales %],
    2, [Décor Sales %],
    3, [Memorabilia Sales %],
    4, [Tailgate Sales %],
    5, [Online Sales %],
    6, [Retail Sales %],
    BLANK (), [Apparel Sales %] )

 
Line Measure Name =
CONCATENATE (
    “Line Measure: “,
    LOOKUPVALUE (
        Line[Line Measure],
        Line[Position], CALCULATE ( MIN ( Line[Position] ) )
    )

 

   )

 

Let me know if you have questions on anything, happy to help.

 

Thanks,

 

Ryan Durkin

Truly people undestimate how much timeand space  you can save doing dynamic measures and dimensions, Also remember you can format the measure in case the aggregation is not on the same level.

 

I have been trying to do the same for Dimensions in the last 2 months but I haven't had luck.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors