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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PBX_user
Regular Visitor

need help on dax calculations

I have 2 table as below and wanted the result after subtracting the count and want to show in visual but this is not showing me the correct result, how I can do it using DAX, basically I am trying to subtract the count , Table1.Count - Table2.Count  and want to achieve result month wise.

 

Table1

Category

Month

Count

Cat1

Jul-23

1

Cat1

Oct-23

7

Cat1

Nov-23

14

Cat1

Dec-23

29

Cat1

Jan-24

72

Cat1

Feb-24

132

Cat1

Mar-24

177

Cat1

Apr-24

216

Cat1

May-24

268

Cat1

Jun-24

305

Cat1

Jul-24

330

Cat1

Aug-24

360

Cat1

Sep-24

388

 

 

Table2

Category

Month

Count

Cat2

Oct-23

1

Cat2

Nov-23

2

Cat2

Jan-24

16

Cat2

Feb-24

36

Cat2

Mar-24

96

Cat2

Apr-24

125

Cat2

May-24

168

Cat2

Jun-24

201

Cat2

Jul-24

242

Cat2

Aug-24

299

Cat2

Sep-24

334

 

 

Result

Month

Count

Jul-23

1

Oct-23

6

Nov-23

12

Dec-23

29

Jan-24

56

Feb-24

96

Mar-24

81

Apr-24

91

May-24

100

Jun-24

104

Jul-24

88

Aug-24

61

Sep-24

54

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

@PBX_user 

 

Download my PBIX fiel with the data and example shown below

 

Create a Date Table and mark it as a date table then create a relationship between it and your 2 other tables.

 

PhilipTreacy_1-1727246127079.png

 

 

Create this measure

 

 

Measure = SUM(Table1[Count]) - SUM(Table2[Count])

 

 

and display it in a table

 

PhilipTreacy_0-1727246080048.png

 

Note that I've formatted the date column to display just the Month-Year

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

@PBX_user 

 

Download my PBIX fiel with the data and example shown below

 

Create a Date Table and mark it as a date table then create a relationship between it and your 2 other tables.

 

PhilipTreacy_1-1727246127079.png

 

 

Create this measure

 

 

Measure = SUM(Table1[Count]) - SUM(Table2[Count])

 

 

and display it in a table

 

PhilipTreacy_0-1727246080048.png

 

Note that I've formatted the date column to display just the Month-Year

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.