Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
amontemayor
New Member

Calculate the Diffrence of two filtered row in Matrix

amontemayor_1-1668020328812.png

Good Day!

 

Can anyone suggest how to calculate the difference of the Quantity of the two given months? differen

 

1 ACCEPTED SOLUTION

Hi @amontemayor ,

According to your description, here's my solution.

1.Create a month number column, because the month column in text compared by alphabetical instead of real month.

If you have a date column in the table, simply create a calculated column.

MonthNum = MONTH([Date])

If not, a calculated column like this instead:

MonthNum=SWITCH([MonthName],
"January",1,
"February",2,
"March",3,
"April",4
.......

2.Create a measure.

Diff =
VAR _Min =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Item Description] = MAX ( 'Table'[Item Description] )
                && 'Table'[MonthNum] = MINX ( ALLSELECTED ( 'Table' ), 'Table'[MonthNum] )
        ),
        'Table'[Quantity]
    )
VAR _Max =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Item Description] = MAX ( 'Table'[Item Description] )
                && 'Table'[MonthNum] = MAXX ( ALLSELECTED ( 'Table' ), 'Table'[MonthNum] )
        ),
        'Table'[Quantity]
    )
RETURN
    _Max - _Min

Then get the difference of selected two month. The result is quantity of big month minus quantity of small month. You can either put it in the matrix or a seperate table visual with the Item Description column.

vkalyjmsft_0-1668046311604.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
amontemayor
New Member

amontemayor_2-1668021178392.png

 

 

 

Hi @amontemayor ,

According to your description, here's my solution.

1.Create a month number column, because the month column in text compared by alphabetical instead of real month.

If you have a date column in the table, simply create a calculated column.

MonthNum = MONTH([Date])

If not, a calculated column like this instead:

MonthNum=SWITCH([MonthName],
"January",1,
"February",2,
"March",3,
"April",4
.......

2.Create a measure.

Diff =
VAR _Min =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Item Description] = MAX ( 'Table'[Item Description] )
                && 'Table'[MonthNum] = MINX ( ALLSELECTED ( 'Table' ), 'Table'[MonthNum] )
        ),
        'Table'[Quantity]
    )
VAR _Max =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Item Description] = MAX ( 'Table'[Item Description] )
                && 'Table'[MonthNum] = MAXX ( ALLSELECTED ( 'Table' ), 'Table'[MonthNum] )
        ),
        'Table'[Quantity]
    )
RETURN
    _Max - _Min

Then get the difference of selected two month. The result is quantity of big month minus quantity of small month. You can either put it in the matrix or a seperate table visual with the Item Description column.

vkalyjmsft_0-1668046311604.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors