Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Dear PBI Masters,
I got set of data showing sales for number of products ( a,b,c,d ets ) with historical month sales ( 18 months starting form 01/20 to 06/21)
I wanted to show sales only for those products that have zero sales in period 07-12/20. That was easy part:)
it goes like this:
Solved! Go to Solution.
Hi @MCG ,
Your measure seems to be wrong:
Please try this instead:
Measure =
var _maxDate=CALCULATE(max('Months'[Date]),ALL('Months'))
var _dateStart=DATE(YEAR(_maxDate)-1,MONTH(_maxDate)+1,1)
var _dateEnd=DATE(YEAR(_maxDate)-1,12,31)
var sales=CALCULATE(SUM(Months[Sales]),DATESBETWEEN('Months'[Date],_dateStart,_dateEnd))
return sales
If you want to dynamically show the X-axis base on the selected date period, you may apply a flag measure to filter pane ,like this:
Flag =
var _maxDate=CALCULATE(max('Months'[Date]),ALL('Months'))
var _dateStart=DATE(YEAR(_maxDate)-1,MONTH(_maxDate)+1,1)
var _dateEnd=DATE(YEAR(_maxDate)-1,12,31)
return IF(MAX('Months'[Date]) >=_dateStart && MAX('Months'[Date])<=_dateEnd,1,0)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MCG ,
Your measure seems to be wrong:
Please try this instead:
Measure =
var _maxDate=CALCULATE(max('Months'[Date]),ALL('Months'))
var _dateStart=DATE(YEAR(_maxDate)-1,MONTH(_maxDate)+1,1)
var _dateEnd=DATE(YEAR(_maxDate)-1,12,31)
var sales=CALCULATE(SUM(Months[Sales]),DATESBETWEEN('Months'[Date],_dateStart,_dateEnd))
return sales
If you want to dynamically show the X-axis base on the selected date period, you may apply a flag measure to filter pane ,like this:
Flag =
var _maxDate=CALCULATE(max('Months'[Date]),ALL('Months'))
var _dateStart=DATE(YEAR(_maxDate)-1,MONTH(_maxDate)+1,1)
var _dateEnd=DATE(YEAR(_maxDate)-1,12,31)
return IF(MAX('Months'[Date]) >=_dateStart && MAX('Months'[Date])<=_dateEnd,1,0)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
91 | |
73 | |
68 | |
63 | |
55 |
User | Count |
---|---|
96 | |
89 | |
73 | |
61 | |
58 |