Forum Discussion

SeungLee95's avatar
SeungLee95
Microsoft Employee
1 year ago
Solved

Use Subtotal Sum in Matrix for a Dynamically formatted Column

I have the following column in my table called SR that has the following values: Null / 1    As seen on the table below, within the Matrix it'll calculate the Subtotal for each row based on the wh...
  • v-echaithra's avatar
    1 year ago

    Hi SeungLee95 ,

    Create a clean numeric measure for calculation.

    SR_Actual =
    IF (
    SELECTEDVALUE(COUDashboard[APType]) = "Classic",
    BLANK(),
    SUM(COUDashboard[ServiceReadiness])
    )

    Use a second measure for display using format string or Conditional Formatting.
    Instead of showing "N/A" directly in the DAX measure, use Conditional Formatting to display "N/A" as a custom string for rows with APType = "Classic".
    Create a DAX measure just for formatting, but you can’t use this for subtotaling, it’s for visual override only.

    DisplayLabel =
    IF (
    SELECTEDVALUE(COUDashboard[APType]) = "Classic",
    "N/A",
    FORMAT([SR_Actual], "#,0")
    )

    Now create a Matrix
    Add the SR_Actual measure to your Matrix.
    Click the measure in the Values area > click the arrow > Conditional formatting > Field value.
    Choose "Based on field" > DisplayLabel.
    Select to apply to "Values only".

    Set the output as custom text,  Power BI will now use "N/A" for classic rows and actual numbers elsewhere.

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

     

    Thanks and regards,

    Chaithra E