Forum Discussion

Lucy01's avatar
Lucy01
Helper I
3 months ago
Solved

Month over Month with multiple text values

I’m trying to create a Month over Month percentage in a matrix and every approach I take results in one error or another.   This is the layout of the data I am using.   To complicate matter...
  • grazitti_sapna's avatar
    3 months ago

    Hi Lucy01,

     

    Issue is with the table format which you're showing in screenshot.

     

    Your data should look like this:-

    | Student | Month      | Rating        | Theme      |
    | ------- | ---------- | ------------- | ---------- |
    | Adam    | 01/01/2024 | Above Average | Homework   |
    | Adam    | 01/01/2024 | Above Average | Classwork  |
    | Adam    | 01/01/2024 | Average       | Sports     |
    | Adam    | 01/01/2024 | Average       | Homework   |
    | Adam    | 01/01/2024 | Below Average | Attendance |
    | Adam    | 01/01/2024 | Below Average | Classwork  |
    

    Firstly Select below columns and unpivot them

     

     

    • Above Average
    • Average
    • Below Average

    Once you do that then use split by delimiter on themes column (to Rows)

    Transform → Split Column → By Delimiter

    Delimiter = ;

    select - Split into Rows

     

    Create a calendar table

     

    Calendar =
    CALENDAR(
    MIN('Sheet1'[Month]),
    MAX('Sheet1'[Month])
    )

     

    Create relationship between date table and your table

     

    and then create dax for current month previous month and MOM%

     

    Total Count =
    COUNTROWS('Sheet1')
    Previous Month Count =
    CALCULATE(
        [Total Count],
        DATEADD('Calendar'[Date], -1, MONTH)
    )
    MoM % =
    VAR CurrentMonth =
        [Total Count]
    
    VAR PreviousMonth =
        [Previous Month Count]
    
    RETURN
    DIVIDE(
        CurrentMonth - PreviousMonth,
        PreviousMonth
    )

    Now you can use these in your visuals and you'll get the correct output.

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    🔗 Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together!