Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi all,
i am having data from Jan 2018 to May 2021
I am currently showing KPIs for a selected range of data which i am using it in a date slicer (between).
i am able to get the selected min date and max date from the dax
var _mindate=min(calander[date])
var _maxdate=max(calander[date])
and i am showing the range for current selected period by
Now here i am facing issue showing the date range.
When i select Sep 18 to Aug 19
Current Year is
For the previous year range label , i have only data from jan 18 but
when i use this measure
Hi @Anonymous
Try this measure:
Previousperioddaterange =
var _mindate=CALCULATE([Mindate],SAMEPERIODLASTYEAR(Calander[Date]))
var _maxdate=CALCULATE([Maxdate],SAMEPERIODLASTYEAR(Calander[Date]))
var PreMindt=if(_mindate>=[Mindate],FORMAT(_mindate,"mmm YYYY"),blank())
var PreMaxdt=if(isblank(PreMindt),blank(),FORMAT(_maxdate,"mmm YYYY"))
return
COMBINEVALUES("-",PreMindt,PreMaxdt)
You can find the previous period regardless of available date, with this code:
Previousperioddaterange =
Var _Min = [Mindate]
Var _Max = [Maxdate]
var _mindate=date(year(_Min)-1,month(_Min),day(_Min))
var _maxdate=date(year(_Max)-1,month(_Max),day(_Max))
var PreMindt=FORMAT(_mindate,"mmm YYYY")
var PreMaxdt=FORMAT(_maxdate,"mmm YYYY")
return
COMBINEVALUES("-",PreMindt,PreMaxdt)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi @VahidDM
I have tried first one its not suitable for my problem, and second one is working fine but in my data i have range from Jan 2018 to May 2021. So if i select a current date range of July 2018 - Dec 2018 it should show "No data" but its showing July 2017 - Dec 2017 for which i dont have a data.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
4 | |
3 |