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.
I want to be able to remove some duplicate account numbers based on whether the account has expired or not. I'm using the following measure to identify whether the acccount has expired in a table based in the account expiry date.
e.g. Account Expiry = DATEDIFF(TODAY(),MAX('Table1'[Account End Date]),DAY), this gives me a value in the Account Expiry Day column, I then want to remove
As you can see by the below table, Account 2 appears twice, but only one is valid, e.g it has 10 days remaining (the other expired 35 days ago) . How can I remove the duplicates accounts which have expired?
Sales Account Name | Account Expiry (Days | Acount Expiry | Account ID |
Account 1 | -50 | 1/02/2018 | 1234 |
Account 2 | -35 | 1/05/2018 | 12345 |
Account 3 | -5 | 1/07/2018 | 123456 |
Account 2 | 10 | 1/08/2018 | 12345 |
Account 5 | 15 | 1/09/2018 | 12345678 |
Account 6 | 20 | 1/10/2018 | 123456789 |
Solved! Go to Solution.
Hi Mooihoek,
You can create a measure using DAX as below:
Result = CALCULATE(MAX(Table1[Account Expiry(Days)]), ALLEXCEPT(Table1, Table1[Sales Account Name]))
PBIX file: https://www.dropbox.com/s/v7dfs2j8yff3tg5/Power%20BI%20Remove%20Duplcates%20based%20on%20measure%20v....
Regards,
Jimmy Tao
Many thanks Jimmy, doesnt appear to be working though, one thing that is different from your example is that my "Account Expiry" column is already a measure.
Can I create a new column from the Account Expiry measure?
Hi Mooihoek,
I have make a measure using Account Expiry(Days) column.
Account Expiry(Days) Measure = MAX(Table1[Account Expiry(Days)])
Then modify [Result] measure as below:
Result = CALCULATE([Account Expiry(Days) Measure], ALLEXCEPT(Table1, Table1[Sales Account Name]))
Regards,
Jimmy Tao
Thats great thanks, noticed through it only works if the Account Expiry hasnt been added to the table, and I need the column. Any ideas on how to get around this?
Hi Mooihoek,
You should change [Account Expiry] as a column because calculate column can't based on aggregation value in DAX.
Regards,
Jimmy Tao
How would I change Account Expiry (which is a measure) to a normal column?
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |