Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello Guys,
I am faced with a classic like for like problem.
I have a set of stores data, and would like to create a column where I can flag which store is "like for like", which one has been closed, which one has been opened from one year to another. See below example.
In my simple mind it is something like: IF StoreID is found in both years then Like for Like; if StoreID is found only in 2021 is Closed; if StoreID only in 2022 is new.
Only thing... I cannot translate this in DAX.
Thanks a lot for your help!
Mario
Year | StoreID | Sales | Status |
2021 | Store_1 | 10 | Like for like |
2022 | Store_1 | 10 | Like for like |
2022 | Store_2 | 10 | Open |
2021 | Store_3 | 10 | Closed |
Solved! Go to Solution.
Hi @MarioA ,
try this calculated column
Column =
VAR MaxYear = MAX('Facts9'[Year])
RETURN
SWITCH(TRUE(),
COUNTROWS(
FILTER(
'Facts9',
'Facts9'[StoreID] = EARLIER('Facts9'[StoreID])
)) > 1, "Like for like",
'Facts9'[Year] = MaxYear,"Open",
'Facts9'[Year] < MaxYear,"Close"
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MarioA ,
try this calculated column
Column =
VAR MaxYear = MAX('Facts9'[Year])
RETURN
SWITCH(TRUE(),
COUNTROWS(
FILTER(
'Facts9',
'Facts9'[StoreID] = EARLIER('Facts9'[StoreID])
)) > 1, "Like for like",
'Facts9'[Year] = MaxYear,"Open",
'Facts9'[Year] < MaxYear,"Close"
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
One of the two would work - I am also open to suggestion on wether to utilise one or the other! Thanks a lot for your reply!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
49 | |
45 | |
38 | |
37 |