cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Helper I
Helper I

Re: Difference between 2 columns in matrix

i use just one table.

Any Suggestion;

Highlighted
Microsoft
Microsoft

Re: Difference between 2 columns in matrix

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

Highlighted
Helper I
Helper I

Re: Difference between 2 columns in matrix

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.
 

 

 

 

Highlighted
Microsoft
Microsoft

Re: Difference between 2 columns in matrix

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

Highlighted
Helper I
Helper I

Re: Difference between 2 columns in matrix

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

 

 

Highlighted
Microsoft
Microsoft

Re: Difference between 2 columns in matrix

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

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors