Forum Discussion

Sjmiller's avatar
Sjmiller
Regular Visitor
2 years ago
Solved

Convert period to consistent time frame

I have some data that I am not sure how to convert. It looks like this: name # Allowed Period Used Jones 3 Week 2 Smith 5 Month 1 Weston 1 Quarter 5 Marley 8 Month 3 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    HI Sjmiller,

    I'd like to suggest you write a measure formula to compare with allowed and used amount based on current user and period group and return different color code to use in conditional formatting.

    Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

    formula=
    VAR allowed =
        CALCULATE (
            SUM ( Table1[# Allowed] ),
            ALLSELECTED ( Table1 ),
            VALUES ( Table1[name] ),
            VALUES ( Table1[Period] )
        )
    VAR used =
        CALCULATE (
            SUM ( Table1[Used] ),
            ALLSELECTED ( Table1 ),
            VALUES ( Table1[name] ),
            VALUES ( Table1[Period] )
        )
    RETURN
        IF ( allowed > used, "Green", IF ( allowed = used, "Yellow", "Red" ) )

    Regards,
    Xiaoxin Sheng