Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Subtraction in Pivot

Hi,

I have a pivot in Power BI, as usual when we select the subtotal it sums up, something like below.

 

 1234
202410304510
202350156
Total15306016

 

What I want is as below and can any one help me how to do this in power BI

 

 1234
202410304510
202350156
Total530304

 

Thanks

Am136

2 Replies

  • Hi Anonymous ,

     

    If you only have two values for year you can create a measure similar to this one:

    Total = IF(
    			ISINSCOPE('Minus Table'[Year]),
    			SUM('Minus Table'[Values]),
    			CALCULATE(
    				SUM('Minus Table'[Values]),
    				'Minus Table'[Year] = MAX('Minus Table'[Year])
    			) - CALCULATE(
    				SUM('Minus Table'[Values]),
    				'Minus Table'[Year] = MIN('Minus Table'[Year])
    			)
    		)

     

    If there are more values please let me know because this needs to be adjusted

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Miguel, 

    Thanks for the quick response. So each year has  1,2,3,4 which is nothing but jan, feb, mar... so its going to be till 12 or Dec. and how do you get the Total at the bottom ? when I add the "Total" measure in the value, it goes on the side of 1, 2,3... column.

    A