The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
Solved! Go to Solution.
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.
Create this measure
Measure = SUM(Table1[Count]) - SUM(Table2[Count])
and display it in a table
Note that I've formatted the date column to display just the Month-Year
Regards
Phil
Proud to be a Super 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.
Create this measure
Measure = SUM(Table1[Count]) - SUM(Table2[Count])
and display it in a table
Note that I've formatted the date column to display just the Month-Year
Regards
Phil
Proud to be a Super User!
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |