Forum Discussion

dlogan's avatar
dlogan
Helper I
2 years ago
Solved

Matrix Visual: Compare 2 coulumns

Is it possible to compare one column with another column in a matrix visual? In other words, I need to calculate the year over year change in acres. Any help would be much appreciated.

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    amitchandak  Thanks for your contribution on this thread.

    Hi dlogan ,

    Whether your problem has been resolved? If yes, could you please mark your post as Answered?

    Otherwise, you can create a measure as below and put it on Values option of matrix...

     

    Difference =
    VAR _year =
        SELECTEDVALUE ( 'Table'[Year] )
    VAR _category =
        SELECTEDVALUE ( 'Table'[Category] )
    VAR _preyear =
        SUMX (
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Category] = _category
                    && 'Table'[Year] = _year - 1
            ),
            [Total Acres]
        )
    RETURN
        [Total Acres] - _preyear

     

    If the above ones can't help you figure out, please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

    How to provide sample data in the Power BI Forum

     

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

2 Replies

  • dlogan , Create a YOY measure and push that to Grand total using isinscope

     

    Current Measure = (SUM(Sales[Sales Amount])

    Year behind Measure = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

     

    YOY = divide( [Current Measure] -[Year behind Measure], [Year behind Measure])

     

    Final Measure = If(isinscope(Date[Year]), [Current Measure], [YOY])

     

    Assuming you are using a date table and date table's field are using in slicer, visual and mesure

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

  • Anonymous's avatar
    Anonymous
    Not applicable

    amitchandak  Thanks for your contribution on this thread.

    Hi dlogan ,

    Whether your problem has been resolved? If yes, could you please mark your post as Answered?

    Otherwise, you can create a measure as below and put it on Values option of matrix...

     

    Difference =
    VAR _year =
        SELECTEDVALUE ( 'Table'[Year] )
    VAR _category =
        SELECTEDVALUE ( 'Table'[Category] )
    VAR _preyear =
        SUMX (
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Category] = _category
                    && 'Table'[Year] = _year - 1
            ),
            [Total Acres]
        )
    RETURN
        [Total Acres] - _preyear

     

    If the above ones can't help you figure out, please provide some raw data in your tables(exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

    How to provide sample data in the Power BI Forum

     

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards