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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
v-yiruan-msft
Community Support
Community Support

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

Community Support Team _ Rena
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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

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

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

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors