Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Conditional Format off of measure

I am looking at percentage changes of patient volume from week to week.   I want to identify when an outlier arises so I calculated the mean and standard deviation. From there I used a z-value of -...
  • jdbuchanan71's avatar
    jdbuchanan71
    7 years ago

    Anonymous ,

    Figured it out, it was the FILTER ( AllSPs...) that was still bringing the row context along.  Just need to change the measre to 

    ASP_Avg_Change = 
    VAR PharmCode = "ASP"
    RETURN 
    IF ( SELECTEDVALUE ( AllSPs[PharmCode] ) = PharmCode,
        CALCULATE (
            AVERAGE ( AllSPs[PercentChange] ),
            ALL ( AllSPs ),
            AllSPs[PharmCode] = PharmCode
        )
    )

    I added the VAR PharmCode because the calc will show on all rows unless we check that we are on an ASP row.

    We also need to update the ASP_Dev_Change the same way

    ASP_Dev_Change = 
    VAR PharmCode = "ASP"
    RETURN 
    IF ( SELECTEDVALUE ( AllSPs[PharmCode] ) = PharmCode,
        CALCULATE (
        STDEV.P ( AllSPs[PercentChange] ),
        ALL ( AllSPs ),
        AllSPs[PharmCode] = PharmCode
        )
    )