Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Write a measure to show multiple data formats

Hi team, I have several metrics with values displayed in different formats, such as decimal or percentage. Problem: I need to display all metric values in a single column in a table based on the se...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Thanks for the reply from Jihwan_Kim .

     

    There is a little problem with your DAX syntax. Since I do not know your [Average People living with HIV recieving ART] and [% CAR By Age] measures, I used the columns directly. This is the adjusted one:

     

    AIIMeasure_text = 
    VAR CurrentIndicator = SELECTEDVALUE('Summary Tab'[Indicator])
    RETURN
    SWITCH (
    TRUE (),
    CurrentIndicator = "Number of People Living with HIV Currently Receiving ART",MAX('Summary Tab'[value]),
    CurrentIndicator = "Contraceptive Acceptance Rate (CAR)",FORMAT(MAX('Summary Tab'[value]) ,"0.0%")  //Assuming the measure is in decimal format
    )

     

     

    Drag the measure to the report page for display.

     

    Select the three dots in the lower right corner, select Sort by, select the measure you created, and select descending order.

     

    pbix file is attached.

     

    I would be grateful if you could provide me with sample data for testing, please remove any sensitive data in advance.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!