The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a table which contains separate values per day, per user. A simplified version of the schema and data
is shown below.
I'd like to return the latest value per user. In this case, the result set would look like this. Not all users are reported on the Max Date, so we have to go back to July 2 to get the latest value for User 1.
Solved! Go to Solution.
I guess the command is something like this? Does this seem correct?
MyValues= SUMMARIZE(MyTable,
MyTable[User],
"LastDate", Max(MyTable[Date]),
"ItemCount", CALCULATE((Max(MyTable[Value])),
Filter(MyTable, MyTable[Date] = Max(MyTable[Date]))))
You can do it this with a summarize table:
Tabla = SUMMARIZE(MaxTable;MaxTable[User];"LastDate";Max(MaxTable[Fecha]);"LastValue";CALCULATE(max(MaxTable[Value]);FILTER(MaxTable;MaxTable[Fecha]=Max(MaxTable[Fecha]))))
Hi @Vvelarde,
The maximum value isnt necessarily the latest entry value per user. You made a good trial but not quite perfect, i think the power query route is still the best approach to handle it.
Cheers.
@Vvelarde thanks for the pointer, but I'm afraid that your DAX won't save. I don't know what Fecha is and PowerBI is expecting commas instead of semi-colons. I can try to work through it, but I think Max() requires two values for example and I just don't know where to take this.
I guess the command is something like this? Does this seem correct?
MyValues= SUMMARIZE(MyTable,
MyTable[User],
"LastDate", Max(MyTable[Date]),
"ItemCount", CALCULATE((Max(MyTable[Value])),
Filter(MyTable, MyTable[Date] = Max(MyTable[Date]))))
I have the same problem.
I used this suggestion to my table, but it didn't work
hi @ChrisWilliams Yeah this is correct.
Fecha is Date (Spanish translation)
And My Version of PowerBI work with ; instead of , . (Regional configuration of my PC)
Ken Puls has an article on what looks like the exact same scenario, keeping the most recent entry per user. I've used it before for something similar. You might check it out and see if that helps! Even though he's doing it in Power Query outside of Power BI Desktop, he's got step-by-step instructions that should cross over.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
77 | |
73 | |
47 | |
39 |
User | Count |
---|---|
137 | |
108 | |
69 | |
64 | |
56 |