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 am facing issue in creating Table 2 from Table 1. Table 1 has historical records for the host. I want to keep the latest row data for each host in Table 2.
please refer Table 1
Host | Date | Status |
Computer1 | 30/11/2022 | Compliant |
Computer2 | 30/10/2022 | Non Compliant |
Computer3 | 30/06/2022 | Compliant |
Computer1 | 25/11/2022 | Compliant |
Computer2 | 25/09/2022 | Compliant |
Computer3 | 25/07/2022 | Non Compliant |
table 2 output should be
Host | Date | Status |
Computer1 | 30/11/2022 | Compliant |
Computer2 | 30/10/2022 | Non Compliant |
Computer3 | 25/07/2022 | Non Compliant |
I am able to get the unique value for the Host column but getting the latest date and related status is showing error.
regards
Salil Singh
Solved! Go to Solution.
@salil , a new table
Filter(AddColumns(Table1, "Max Date", maxx(filter(Table, [Host] = earlier([Host])), [Date])), [Date] = [Max Date])
Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Hi @salil ,
If you want a seperate table, @amitchandak 's solution works fine. If you want a visual to display the expected result, here's my solution. Create a measure:
Measure =
IF (
MAX ( 'Table'[Date] )
= MAXX (
FILTER ( ALL ( 'Table' ), 'Table'[Host] = MAX ( 'Table'[Host] ) ),
'Table'[Date]
),
1,
0
)
Put the measure in the visual filter and set to 1.
After apply filter, get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@salil , a new table
Filter(AddColumns(Table1, "Max Date", maxx(filter(Table, [Host] = earlier([Host])), [Date])), [Date] = [Max Date])
Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
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 |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |