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 experts,
I want to display the value for maximum year.
For example, the maximum year will be the latest year which is 2022, so the values should only display data for year 2022. But there are few values from year 2020 also have been displayed which is not correct.
My formula looks like below.. Need your help & insights on this..
Hi @Anonymous ,
You can try this code to create a measure.
Value in Max Year =
VAR _latestYear =
YEAR ( MAXX ( ALL ( 'table' ), 'table'[date] ) )
VAR _valueX =
CALCULATE (
SUM ( 'table'[Value] ) / 1000,
FILTER (
'table',
AND ( table[category] = "pink", YEAR ( 'table'[date] ) = _latestYear )
)
)
RETURN
_valueX
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Try a measure like (With help from a separate date table
var latestYear = YEAR(MAX('table'[date]))
CALCULATE(SUM('table'[Value])/1000, table[category]= "pink",
filter(all('Date') , YEAR('Date'[date])=latestYear) )
refer
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
112 | |
80 | |
65 | |
48 | |
38 |