Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Team !
I'm Struggling with the select period date values for LAST YEAR sales ,
For select period Current Year Sale for DAX is as follows please suggest a DAX for Last YEAR considering followin Current Year DAX.
Solved! Go to Solution.
Hi @Anonymous ,
If you want to calcualte the total sales for previous period of selected period, you could create a flag measure:
Flag =
var _min=DATE(YEAR(MIN('Dates'[Date]))-1,MONTH(MIN('Dates'[Date])),DAY(MIN('Dates'[Date])))
var _max=DATE(YEAR(MAX('Dates'[Date]))-1,MONTH(MAX('Dates'[Date])),DAY(MAX('Dates'[Date])))
return IF( MAX('Sale Calculation'[Date]) >=_min && MAX('Sale Calculation'[Date])<=_max,1,0)
And apply it to visual-filter pane, set as "is 1":
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 @Anonymous ,
If you want to calcualte the total sales for previous period of selected period, you could create a flag measure:
Flag =
var _min=DATE(YEAR(MIN('Dates'[Date]))-1,MONTH(MIN('Dates'[Date])),DAY(MIN('Dates'[Date])))
var _max=DATE(YEAR(MAX('Dates'[Date]))-1,MONTH(MAX('Dates'[Date])),DAY(MAX('Dates'[Date])))
return IF( MAX('Sale Calculation'[Date]) >=_min && MAX('Sale Calculation'[Date])<=_max,1,0)
And apply it to visual-filter pane, set as "is 1":
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.
How about an all selected on your slicer values. Extract min and max date out of that filter context and then reduce both dates by one year and use this in a calculate function?
Hi Daniel,
Actually Not getting can you please form a DAX as per your knowlegde here and will try it on my measures .
Even i'm New to Power BI.
Hope you getting me.
Hi @Anonymous ,
cannot comment on your formula, but did you try use
DATESYTD & SAMEPERIODLASTYEAR
CALCULATE('Sale Calculation'[Total Sales], <-Measure or column? If column might need to put it into sum()
DATESYTD(
SAMEPERIODLASTYEAR(Dates[Date])
)
)
YES but using this DAX i'm just fecthing last year whole sales total
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
75 | |
54 | |
37 | |
31 |
User | Count |
---|---|
99 | |
56 | |
50 | |
42 | |
40 |