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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Betissa
Helper I
Helper I

Difference between 2 columns in matrix

Hello I would like to use a matrix in the visualization part which displays a field representing the difference between two columns displayed by the same matrix how can I do to achieve this manipulation ?
Your suggestions !!
thank you in advance.

ecart.png

 

 

 

 

 

 

6 REPLIES 6
v-huizhn-msft
Employee
Employee

Hi @Betissa,

You’d better create a measure like the following formula, and add the measure as value level in matrix. Then check if it works fine.

difference=CALCULATE(sum(field1-field2), ALLEXCEPT(Rubrique))

I am not reproduce your scenario based on your description, if this is not what you want, please share your resource data for further analysis.

Best Regards,
Angelia

Hi Angelia, thanks for your answer.

Here is my dataset I would like to make a grouping of the Mt HT according to the field Field and to make the difference between the Mt Ht of Currentyear and and the Mt Ht of PreviousYear for each customer in order to see the evolution of the MtHt according to the two successive years.

extract.PNG

 

It can be noted that a single customer can repeat 2 or 3 times in the same year
I am very new in the world of power bi, what you propose me to do.
Thank you very much.
 

 

 

 

Hi @Betissa,

I try to reproduce your scenario and get the desired result. 

First, please create measures using the following formulas.

Total1 = SUM(Table2[MtHT])

Difference = CALCULATE(Table2[Total1], Table2[RubriQue2]="Currentyear")-CALCULATE(Table2[Total1],Table2[RubriQue2]="PreviousYear")


Then create a matrix, select the Code Com row level, Rubrique2 as column level, the measure as value level. You will get the result like second screenshot below.

Capture2.PNGCapture1.PNG

If you have any other issue, please let me know.

Best Regards,
Angelia

Hi @v-huizhn-msftThanks for your answer

I followed your instructions but the results were abnormal here is a screenshot of what was produced.issue.pngSorry I hid the column of Nom Comercial for privacy reasons.
in my case Réalisé + Liv N - 1 is previousyear and Réalisé + Liv N is CurrentYear

 

 

Hi @Betissa,

It's weird, the value in RubriQue2 is year level? If it isn't, please add a year column, then select year column as column level in Matrix visual.

Best Regards,
Angelia

Betissa
Helper I
Helper I

i use just one table.

Any Suggestion;

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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