Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
i want to get the detail of changes between weeks .
two weeks of data is on one query
I want to report on only the changes in purchases from week to week and get the detail of the extra purchase.
WeekBegining | 30/6/24 | 07/07/204 |
Week1 | Week2 | |
Customer A | Product A | Product A |
Product B | Product B | |
Product C | Product C | |
Product D | Product D | |
Product E | ||
Customer B | Product A | Product A |
Customer C | Product A | Product B |
Product B |
Result should look like this
Change | Details | |
Customer A | +1 | Product E |
Customer C | -1 | Product A |
thanks in advance
Solved! Go to Solution.
Hi @rafterse ,
@Ashish_Mathur Thanks for your concern about this case!
And @rafterse , here is my sample data:
Use this DAX to create a measure to calculate the change:
Change =
VAR _1 =
CALCULATE(
DISTINCTCOUNT('Table'[Week1]),
ALLEXCEPT('Table', 'Table'[Customer]),
'Table'[Week1] <> BLANK()
)
VAR _2 =
CALCULATE(
DISTINCTCOUNT('Table'[Week2]),
ALLEXCEPT('Table', 'Table'[Customer]),
'Table'[Week2] <> BLANK()
)
RETURN
_2 - _1
And use this DAX to create another measure to filter the detail columns:
Measure 2 =
IF(
(MAX('Table'[Week1]) <> BLANK() && MAX('Table'[Week2]) = BLANK()) || (MAX('Table'[Week1]) = BLANK() && MAX('Table'[Week2]) <> BLANK()),
1,
0
)
Put the column Customer, Week1, Week2 and the measure Change into the table visual:
And put the Measure 2 into the Filters on this visual:
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rafterse ,
@Ashish_Mathur Thanks for your concern about this case!
And @rafterse , here is my sample data:
Use this DAX to create a measure to calculate the change:
Change =
VAR _1 =
CALCULATE(
DISTINCTCOUNT('Table'[Week1]),
ALLEXCEPT('Table', 'Table'[Customer]),
'Table'[Week1] <> BLANK()
)
VAR _2 =
CALCULATE(
DISTINCTCOUNT('Table'[Week2]),
ALLEXCEPT('Table', 'Table'[Customer]),
'Table'[Week2] <> BLANK()
)
RETURN
_2 - _1
And use this DAX to create another measure to filter the detail columns:
Measure 2 =
IF(
(MAX('Table'[Week1]) <> BLANK() && MAX('Table'[Week2]) = BLANK()) || (MAX('Table'[Week1]) = BLANK() && MAX('Table'[Week2]) <> BLANK()),
1,
0
)
Put the column Customer, Week1, Week2 and the measure Change into the table visual:
And put the Measure 2 into the Filters on this visual:
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Is there a date column? If yes, then share that column as well.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
12 | |
9 | |
9 | |
9 |
User | Count |
---|---|
19 | |
14 | |
14 | |
13 | |
12 |