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
smileamile2
Resolver I
Resolver I

Dynamic measure with different data types

I have a dynamic measure that, based on measure filter selection, it will show either Gross Revenue or Shipment Count. It works fine when there is no formatting set, but I would like to display Gross Revenue as dollars, while keeping Shipment Count as an integer. It seems to work fine in a table, but formatted values won't work in a chart. Is there any way to make this work?

 

Without formatting:

 

Selected Metric = SWITCH( 
    SELECTEDVALUE('Measure Selection'[MeasureID]),
        "GrossRevenue", [Gross Revenue],
        "ShipmentCount", [Shipment Count],
        BLANK() 
    )

 

smileamile2_0-1647639911481.png

 

With formatting:

 

Selected Metric = SWITCH( 
    SELECTEDVALUE('Measure Selection'[MeasureID]),
        "GrossRevenue", format([Gross Revenue], "$#,##0"),
        "ShipmentCount", [Shipment Count],
        BLANK() 
    )

 

smileamile2_1-1647639972464.png

 

Follow-up question. Is it possible to dynamically change the measure name on visuals based on filter value selection?

1 ACCEPTED SOLUTION
davehus
Memorable Member
Memorable Member

Hi @smileamile2 , Format doesn't work within a line chart from my knowledge. Would another approach to be create a bookmark and create a button selection, so the user can switch between both. It would give you the flexbility you need. 

 

View solution in original post

3 REPLIES 3
smileamile2
Resolver I
Resolver I

@davehus Ah darn. Main point was to not have to setup so many measures, because I have a ton of metrics to add to the list, and need to have current, last year, YoY, PoP, Variances, and Variance % for all of them. Bummer. Appreciate the help!

No problem, sometimes these things are never as straigforward as you'd hope. 🙂 

 

D

davehus
Memorable Member
Memorable Member

Hi @smileamile2 , Format doesn't work within a line chart from my knowledge. Would another approach to be create a bookmark and create a button selection, so the user can switch between both. It would give you the flexbility you need. 

 

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.