Forum Discussion

smileamile2's avatar
smileamile2
Resolver I
4 years ago
Solved

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() 
    )

 

 

With formatting:

 

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

 

 

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

  • 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. 

     

3 Replies

  • davehus's avatar
    davehus
    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. 

     

  • 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!

    • davehus's avatar
      davehus
      Memorable Member

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

       

      D