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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

How to add Variance Column to Matrix

Hello,

I am pretty new to PowerBI and  I am trying to add a few columns to the below matrix that would calculate the difference between each reporting pariod:

 

mattzee_0-1676311002013.png

 

In other words, I need 3 more columns that would show Acct, Balance and WAR variance from 2022 to 2023.

 

Any help, greatly appreciated.

 

Thanks,

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create the measures as below to replace the original measures [Acct],[Balance] and [WAR]:

Acct Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [Acct] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [Acct] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [Acct], _2023 - _2022 )
Balance Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [Balance] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [Balance] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [Balance], _2023 - _2022 )
WAR Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [WAR] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [WAR] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [WAR], _2023 - _2022 )

yingyinr_0-1676342119066.png

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

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

You can create the measures as below to replace the original measures [Acct],[Balance] and [WAR]:

Acct Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [Acct] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [Acct] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [Acct], _2023 - _2022 )
Balance Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [Balance] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [Balance] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [Balance], _2023 - _2022 )
WAR Variance =
VAR _2022 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2022, 12, 31 ) ), [WAR] )
VAR _2023 =
    SUMX ( FILTER ( 'Table', 'Table'[ProdDt] = DATE ( 2023, 1, 31 ) ), [WAR] )
RETURN
    IF ( ISINSCOPE ( 'Table'[ProdDt] ), [WAR], _2023 - _2022 )

yingyinr_0-1676342119066.png

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

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.