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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Glory1891
New Member

Help Dax

Hi everyone,

 

In Power Bi I created 3 pie charts.
The 1st contains data from 2018, the 2nd data from 2019 and the 3rd the data from 2018 and 2019 combined.
I would like to calculate the difference between 2018 - 2019 using a 4th pie chart.

 

I have created 2 tables, the first table with the data from 2018 and the 3rd table from 2019.

ChatGpt says that I should use formula: 'Difference 2018-2019 = SUM(YourTable[Revenue 2018]) - SUM(YourTable[Revenue 2019])'.

Unfortunately, I get the following error: Cannot find the table Difference2018-2019=SUM(2018[revenue2018])-SUM(2019[revenue2019]).

 

The titles of my columns are 2018 and 2019, But unfortunately I'm doing something wrong.

Can someone help me please? 

Glory1891_1-1699182446275.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Glory1891 ,

Below is my 2019 table:

vxiandatmsft_0-1699343378935.png

Below is my 2018 table:

vxiandatmsft_1-1699343390836.png

First , you need to configure the relationship for the two tables:

vxiandatmsft_2-1699343436435.png

The following DAX might work for you:

Measure = 
   var p_2018 = SELECTEDVALUE('2018'[Som value])
   var p_2019 = SELECTEDVALUE('2019'[Som value])
   var result = 
       CALCULATE(
         p_2019 - p_2018,
         ALL('2018'[Product])
       )
    return result

The final output is shown in the following figure:

vxiandatmsft_3-1699343493692.png

Best Regards,

Xianda Tang

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Glory1891 ,

Below is my 2019 table:

vxiandatmsft_0-1699343378935.png

Below is my 2018 table:

vxiandatmsft_1-1699343390836.png

First , you need to configure the relationship for the two tables:

vxiandatmsft_2-1699343436435.png

The following DAX might work for you:

Measure = 
   var p_2018 = SELECTEDVALUE('2018'[Som value])
   var p_2019 = SELECTEDVALUE('2019'[Som value])
   var result = 
       CALCULATE(
         p_2019 - p_2018,
         ALL('2018'[Product])
       )
    return result

The final output is shown in the following figure:

vxiandatmsft_3-1699343493692.png

Best Regards,

Xianda Tang

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

speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your dax and reports that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the solution. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Also provide the example desired output, with a clear description of the process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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