Forum Discussion

amikm's avatar
amikm
Icon for Helper V rankHelper V
4 years ago
Solved

Issue with matrix visual in Power BI

I need to create a visual like this 

 

 

I have created a measure to get Last year MemberCount
MemberCount(LY): CALCULATE(Member[MemberCount],SAMEPERIODLASTYEAR(Date[Date]) //This will give 100

 

Note: MemberCount is a field coming from Source where we formatted in Power Bi desktop itself to take count // this will give 105

 

I am not getting a similar or exact visual on the Power BI desktop, I tried Matrix visual, where I kept MonthYear in Columns and those two measures in the value bucket.

 

 

 

 

  • Hi amikm ,

     

    Please try the following formula:

     

    MemberCount(LY) = 
    VAR currentmonth =
        FORMAT ( TODAY (), "yyyy-mm" )
    VAR lastyear =
        FORMAT ( EDATE ( TODAY (), -12 ), "yyyy-mm" )
    RETURN
        IF (
            MAX ( 'Date'[MonthYear] ) IN { currentmonth, lastyear },
            SUM ( 'Member'[source] )
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • amikm , The display using "Show on Row" property of Matrix

    Month year on column, measure on values - enable show on row

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi amikm ,

     

    Please try the following formula:

     

    MemberCount(LY) = 
    VAR currentmonth =
        FORMAT ( TODAY (), "yyyy-mm" )
    VAR lastyear =
        FORMAT ( EDATE ( TODAY (), -12 ), "yyyy-mm" )
    RETURN
        IF (
            MAX ( 'Date'[MonthYear] ) IN { currentmonth, lastyear },
            SUM ( 'Member'[source] )
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.