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 need to buid a graph with for last 3 years (2019 inclusive)
what expression do i need to obtain comparable data (same months) - if i have data on 2019 for jan & feb also 2017 and 2018 have to be only for jan&feb
i use a calendar (1 jan 2017 till 31 dec 2019) connected with the data base
let's take a simple example
salesman sales year month
Solved! Go to Solution.
Hello,
Would this help?
Measure 4 = VAR MaxYear = CALCULATE(MAX(Table5[Year]), ALL(Table5)) VAR MaxMonth = CALCULATE(MAX(Table5[Month]), Table5[Year] = MaxYear) RETURN CALCULATE(SUM(Table5[Sales]), FILTER(Table5, Table5[Month] <= MaxMonth && Table5[Year] >= MaxYear - 2))
Regards,
ElenaN
hi, @cosminc
You could try this measure:
Measure = VAR MaxYear = CALCULATE(MAX('Date'[Year]), ALLSELECTED('Date')) VAR MaxMonth = CALCULATE(MAX('Date'[Month]), FILTER(ALLSELECTED('Date'),'Date'[Year] = MaxYear)) return CALCULATE(SUM(Table1[Qty]), FILTER('Date', 'Date'[Month] <= MaxMonth&&'Date'[Year]>=MaxYear-2))
Result:
By the way, if you don't select any value in silcer, it will return all the data.
and for ElenaN formula if you use slicer only filter two years data, it will return blank value.
Best Regards,
Lin
Hello,
Would this help?
Measure 4 = VAR MaxYear = CALCULATE(MAX(Table5[Year]), ALL(Table5)) VAR MaxMonth = CALCULATE(MAX(Table5[Month]), Table5[Year] = MaxYear) RETURN CALCULATE(SUM(Table5[Sales]), FILTER(Table5, Table5[Month] <= MaxMonth && Table5[Year] >= MaxYear - 2))
Regards,
ElenaN
Hi and thanks for your help
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |