Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ManojMunjeti
New Member

Show data for last 8 quarters on line chart from a quarter value selected

I am working on a dax function where the requirement is
Requirement: I select a quarter value from slicer and my line chart shows data for the last 8 quarters.

Additional requirement: If there is no data for a specific quarter the data should show 0 on the line chart

My work: I did create another calendar table called previous dates and here is my dax.

 
Total Risk Events Past 24 Months =
var ReferenceDate = MAX(Dates[Date])
var PreviousDates =
DATESINPERIOD(
'Previous Date'[Date],
ReferenceDate,
-24,
MONTH)
var Result =
CALCULATE((DISTINCTCOUNT('Risk Events'[Event ID])),
REMOVEFILTERS(Dates),
KEEPFILTERS(PreviousDates),
USERELATIONSHIP(Dates[Date],'Previous Date'[Date])
)
Return
Result
 
and I do get the result I want except that the quarter where there is no value assigned gets skipped from the axis.

Where there is data for all 8 quarters:
ManojMunjeti_0-1650990383255.png

Where there is no data for all 8 quarters from a selected quarter:

ManojMunjeti_1-1650990433500.png

Despite no values for all 8 quarters, I want the values to all show up on the chart and show as 0.
Your ideas on this is much appreciated.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ManojMunjeti , if you select one qtr and what to show more than that you need an independent date table in the slicer

 

example

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -24) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

refer

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@ManojMunjeti , if you select one qtr and what to show more than that you need an independent date table in the slicer

 

example

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -24) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

refer

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.