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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chua129
Helper I
Helper I

Need help in getting the difference

Hi Everyone,

 

I need help in getting the difference between two columns. I want to get the difference of those number in 2017 and in 2018. The 2017 and 2018 is inside the same column.

 

Capture.PNGThanks!

1 ACCEPTED SOLUTION

@chua129

 

This is unfortunately the problem with Using Columm Field.

You will get a MEASURE for each distinct value of the Column

 

There are 2 ways to deal with it

 

1) you can hide the extra MEASURE Column...hide the totals.....But you will have to adjust the Word wrap properties

I do not recommend this.

2) Another approach is to Remove the YEAR from columns and instead use 3 MEASURES as follows.
Put these MEASURES in the VALUES section

2018=CALCULATE ( Expression, Table1[Year] = 2018 )

2017=CALCULATE ( Expression, Table1[Year] = 2017)

Difference = [2018] - [2017]




Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

@chua129

 

Try this pattern

 

Measure =
CALCULATE ( Expression, Table1[Year] = 2018 )
    - CALCULATE ( Expression, Table1[Year] = 2017 )

 


Regards
Zubair

Please try my custom visuals

What do I put for the Expression? COUNT(...)?

Yes

Regards
Zubair

Please try my custom visuals

I have obtained the difference. However, it is showing at every part of the column as shown in the image below. Is it possible to make something like:

 

Year                  2017    2018 Difference

 

With Mobile    7            5         -2

 

Capture2.PNG

@chua129

 

This is unfortunately the problem with Using Columm Field.

You will get a MEASURE for each distinct value of the Column

 

There are 2 ways to deal with it

 

1) you can hide the extra MEASURE Column...hide the totals.....But you will have to adjust the Word wrap properties

I do not recommend this.

2) Another approach is to Remove the YEAR from columns and instead use 3 MEASURES as follows.
Put these MEASURES in the VALUES section

2018=CALCULATE ( Expression, Table1[Year] = 2018 )

2017=CALCULATE ( Expression, Table1[Year] = 2017)

Difference = [2018] - [2017]




Regards
Zubair

Please try my custom visuals

The second approach works like wonder!

 

Thanks @Zubair_Muhammad 

 

You saved my life! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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