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

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.

Reply
devika
Helper II
Helper II

Line graph to stop showing future Quarters

Hi All,

 

I have connected to Oracle SQL. I used Year and Quarter from the Date hierarchy for the X-axis. I haven't created a separate Date table. There is a data lag in the dataset. As you can see, 'Maxofdate' is five weeks behind from today, and this is going to be subjective. I want the line graph to stop showing at 'Maxofdate-Quarter' and not showing the future Quarters.

The below graph should show only until 2023 Q1, not other Quarters with blanks.

Creating a date table won't help, and I can't use visual or page filters to remove blanks; I can use filters only in the Measures.

 

devika_2-1675813856226.png

check =


VAR MinDate = Min([DATE])
VAR MaxDate = Max(DATE])
RETURN
CALCULATE(IF(MAX[DATE]) < MinDate || MAX([CASE_DATE]) > MaxDate,BLANK(),[answer]))

 

Any thoughts are much appreciated.

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@devika , Try like

 

check =

VAR MinDate = MinX(allselected(Date), [DATE])
VAR MaxDate = MaxX(allselected(Date),DATE])
RETURN
CALCULATE(IF(MAX([DATE]) < MinDate || MAX([CASE_DATE]) > MaxDate,BLANK(),[answer]) )

View solution in original post

devika
Helper II
Helper II

Thanks Amit, it works perfectly.

View solution in original post

3 REPLIES 3
devika
Helper II
Helper II

Thanks Amit, it works perfectly.

amitchandak
Super User
Super User

@devika , Try like

 

check =

VAR MinDate = MinX(allselected(Date), [DATE])
VAR MaxDate = MaxX(allselected(Date),DATE])
RETURN
CALCULATE(IF(MAX([DATE]) < MinDate || MAX([CASE_DATE]) > MaxDate,BLANK(),[answer]) )

Hi. This has a side-effect, I believe. If you put this measure in a table visual, the grand total of the year will be blank when we are in the current year. Any way to avoid this? the grand total should be the last nonblank value of the measure.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.