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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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