Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I would like to retrieve in a new column in DAX, called Last Occurrence, 1 for the last occurence of each record, per week and 0 for the others.
Below is what I want to replicate.
Many thanks in advance,
Melisa
record | date | weekno | Last Occurrence |
1001482 | 2/11/2020 | 7 | 0 |
1001482 | 2/13/2020 | 7 | 0 |
1001482 | 2/14/2020 | 7 | 0 |
1001482 | 2/15/2020 | 7 | 1 |
1001482 | 2/17/2020 | 8 | 0 |
1001482 | 2/18/2020 | 8 | 0 |
1001482 | 2/19/2020 | 8 | 1 |
1001482 | 2/24/2020 | 9 | 0 |
1001482 | 2/25/2020 | 9 | 0 |
1001482 | 2/26/2020 | 9 | 1 |
1254333 | 2/11/2020 | 7 | 0 |
1254333 | 2/13/2020 | 7 | 0 |
1254333 | 2/14/2020 | 7 | 1 |
1254333 | 2/17/2020 | 8 | 0 |
1254333 | 2/18/2020 | 8 | 1 |
1254333 | 2/24/2020 | 9 | 0 |
1254333 | 2/25/2020 | 9 | 0 |
1254333 | 2/26/2020 | 9 | 0 |
1254333 | 2/27/2020 | 9 | 1 |
Solved! Go to Solution.
Try a new column like
Last Occurrence = if(table[date] - maxx(filter(table,table[record]=earlier(table[record]) && table[week]=earlier(table[week])),table[date]), 1, 0)
Try a new column like
Last Occurrence = if(table[date] - maxx(filter(table,table[record]=earlier(table[record]) && table[week]=earlier(table[week])),table[date]), 1, 0)
Hi @amitchandak
Unfortunately the datemaxx function you mentioned in the formula is not recognized by Power BI. Can we use smtg else instead?
Thank you,
Melisa
@amitchandak I have used the MAXX function and it's working. Thank you very much!
Thanks for pointing out. I corrected the original post. Kudos to You !!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |