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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
mdonawho
Frequent Visitor

Beginner Help - Want to add variance column to table

I am trying to figure out how to add a variance column (difference between 2021 and 2022 for March would be -20) to a table.  Any help would be appreciated.

mdonawho_0-1673601991268.png

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @mdonawho ,

 

It seems that you are using a Matrix visual?

vjianbolimsft_0-1673861018857.png

If so please try:

Rename the Column Subtotal:

vjianbolimsft_1-1673861087912.png

Then apply the measure to the value field:

Measure =
IF (
    ISINSCOPE ( 'Table (2)'[Year] ),
    SUM ( 'Table (2)'[Value] ),
    CALCULATE ( SUM ( 'Table (2)'[Value] ), FILTER ( 'Table (2)', [Year] = 2022 ) )
        - CALCULATE ( SUM ( 'Table (2)'[Value] ), FILTER ( 'Table (2)', [Year] = 2021 ) )
)

Output:

vjianbolimsft_2-1673861355447.png

Another solution:

You can Pivot your column:

vjianbolimsft_3-1673861445675.png

Output:

vjianbolimsft_4-1673861461298.png

Then create a measure like @negi007  mentioned :

Varience = SUM('Table'[2022]) - SUM('Table'[2021])

Final output:

vjianbolimsft_5-1673861597572.png

Best Regards,

Jianbo Li

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

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @mdonawho ,

 

It seems that you are using a Matrix visual?

vjianbolimsft_0-1673861018857.png

If so please try:

Rename the Column Subtotal:

vjianbolimsft_1-1673861087912.png

Then apply the measure to the value field:

Measure =
IF (
    ISINSCOPE ( 'Table (2)'[Year] ),
    SUM ( 'Table (2)'[Value] ),
    CALCULATE ( SUM ( 'Table (2)'[Value] ), FILTER ( 'Table (2)', [Year] = 2022 ) )
        - CALCULATE ( SUM ( 'Table (2)'[Value] ), FILTER ( 'Table (2)', [Year] = 2021 ) )
)

Output:

vjianbolimsft_2-1673861355447.png

Another solution:

You can Pivot your column:

vjianbolimsft_3-1673861445675.png

Output:

vjianbolimsft_4-1673861461298.png

Then create a measure like @negi007  mentioned :

Varience = SUM('Table'[2022]) - SUM('Table'[2021])

Final output:

vjianbolimsft_5-1673861597572.png

Best Regards,

Jianbo Li

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

negi007
Community Champion
Community Champion

@mdonawho in this case you can create below measures

2021_value = CALCULATE(SUM(sales[value]),YEAR=2021)

2022_value = CALCULATE(SUM(sales[value]),YEAR=2022)

variance = [2022_value]-[2021_value]

 

you can then use these measures in your matrix to view value for each of the measure




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

amitchandak
Super User
Super User

@mdonawho , Create MOYM measure and use that in column total using isinscope

 

measure = if(isinscope(Table[Year]), [MTD], [MOYM])

 

 

Measure using time intelligence and date table

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))


last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
Previous year Month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth(dateadd('Date'[Date],-11,MONTH)))
last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))

 

 

MOYN =[MTD Sales] - [last year MTD Sales]

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you for your reply.  I am not understanging the steps you are directing me to take. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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