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.
Hello,
I have a database that has the following colunms: Product, Date and value. I need to get the value of the last date per product, to put in a card. How can I do this?
Best regards!
Solved! Go to Solution.
@VitorXavierCell , Refer my these two blogs
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Hi @VitorXavierCell ,
You can try the following methods.
Here is my test table:
Measure:
Max date =
CALCULATE (
MAX ( 'Product'[Date] ),
FILTER ( 'Product', [Product] = SELECTEDVALUE ( 'Product'[Product] ) )
)
Max date value =
CALCULATE (
MAX ( 'Product'[Value] ),
FILTER (
'Product',
[Date] = [Max date]
&& [Product] = SELECTEDVALUE ( 'Product'[Product] )
)
)
The result is:
Is this the result you expect?
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @VitorXavierCell ,
You can try the following methods.
Here is my test table:
Measure:
Max date =
CALCULATE (
MAX ( 'Product'[Date] ),
FILTER ( 'Product', [Product] = SELECTEDVALUE ( 'Product'[Product] ) )
)
Max date value =
CALCULATE (
MAX ( 'Product'[Value] ),
FILTER (
'Product',
[Date] = [Max date]
&& [Product] = SELECTEDVALUE ( 'Product'[Product] )
)
)
The result is:
Is this the result you expect?
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Why is this accepted as solution when SELECTEDVALUE would only work when there's exactly one value selected for a given dimension? There could easily me more than one or none Product(s) selected at all...
@VitorXavierCell , Refer my these two blogs
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Why can't we just use LASTNONBLANK/LASTNONBLANKVALUE here?
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
28 | |
13 | |
12 | |
9 | |
8 |