The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello everyone,
i need your help in writing a DAX Formula that returns distinct values for a row, based on max date that is smaller or equal to the value chosen in a slicer.
So i have a DataTable which is being loaded every day with new rows that have been updated. As you can see every change in the customer data is updated, by adding a new row with new loadtime.
Example:
Customer | Name | Postal Code | Loadtime |
XXX | John | 555 555 | 22.02.2023 |
XXX | John | 666 666 | 20.02.2023 |
YYY | Elisabeth | 444 444 | 22.02.2023 |
YYY | Emma | 444 444 | 15.02.2023 |
ZZZ | Jules | 111 111 | 11.02.2023 |
So if i choose a DATE with a SLICER : 22.02.2023
I want to get is a table that looks like this:
Customer | Name | Postal Code | Loadtime |
XXX | John | 555 555 | 22.02.2023 |
YYY | Elisabeth | 444 444 | 22.02.2023 |
ZZZ | Jules | 111 111 | 11.02.2023 |
but if i change the slicer value to : 11.02.2023
i want a table to look like this:
Customer | Name | Postal COde | Loadtime |
ZZZ | Jules | 111 111 | 11.02.2023 |
I have tried different formulas but was unfortunately not successful. Would apperciate your help.
Best Regards
yes
Try by placing the following measure in the filter pane of the table visual and select "is" (1) then apply the filter
FilterMeasure =
INT (
MAX ( DataTable[Loadtime] )
= CALCULATE (
MAX ( DataTable[Loadtime] ),
ALLEXCEPT ( DataTable, DataTable[Name] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
)
)
hi @CarMechanic
hello @FreemanZ ,
thanks for the fast response.
Unfortunately this solution doesnt cover all the changes that can happen in a row. The tables i have posted are only examples. The real data rows consist of 30 columns with different attributes. Whenever one of the attributes changes, a new row with new loadtime will be added for a customer. So the solution must be more flexible than that. But thanks 🙂
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
12 | |
9 | |
7 |