The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Categories | Quantity | Sort |
a | 54 | 1 |
a | 76 | 2 |
a | 8 | 3 |
a | 7 | 4 |
a | 4 | 5 |
b | 2 | 1 |
b | 6 | 2 |
b | 68 | 3 |
b | 454 | 4 |
b | 97 | 5 |
b | 2 | 6 |
c | 9 | 1 |
c | 5 | 2 |
c | 4 | 3 |
c | 7 | 4 |
c | 54 | 5 |
I have a data set that look like above and I want to create a measure calculation to find the last value of Quantity column by grouping with Categories column.
I c ould create a new table using the following dax measure, but I want to create a measure not a table.
Table New = SUMMARIZE(
Table,Table[Categories],
"Last Value",
CALCULATE(SUM(Table[Quantity]),
FILTER(Table,Table[Sort]=Max(Table[Sort]))
)
)
Could anyone please help me to use this logic and create a measure rather than calculated table.
Solved! Go to Solution.
Hi @Anonymous
you can do it like this:
Last Value =
CALCULATE (
MAX ( 'Table'[Quantity] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Categories] ),
'Table'[Sort] = MAX ( 'Table'[Sort] )
)
)
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Hi @Anonymous
you can do it like this:
Last Value =
CALCULATE (
MAX ( 'Table'[Quantity] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Categories] ),
'Table'[Sort] = MAX ( 'Table'[Sort] )
)
)
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Hi @Anonymous or try this
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
https://www.dropbox.com/s/859um2z34didt66/surafel.pbix?dl=0
@Anonymous try this measure
Top Qty = CALCULATE ( SUM ( Cat[Quantity] ), TOPN ( 1, ALLSELECTED ( Cat[Sort] ), CALCULATE ( MAX ( Cat[Sort] ) ), DESC ) )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.