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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
superhayan
Helper I
Helper I

Failed to Show Data of Certain Period using a "Flag" Visual Level Filter

Hello all,

 

I have a Calendar table and a 'Product' table with columns: Product, Date, Price, etc. The 2 tables have NO relationship.

In the Report View, I have a slicer on the Calendar table.

I also have 2 date-related measures to help me look at a 2-month period:

Min Date = max('Calendar'[date])

Max Date = EOMONTH([Min Date], 2)

In this setting, if I choose 1 Oct 2024 in the slicer, then Min Date = 1 Oct 2024; Max Date = 31 Dec 2024.

 

Now I have a bar chart with x-axis = Product and y-axis = Price. I want the chart to show only data in the period I choose so I have made below measure:

Flag_within period = IF(MIN('Product'[Date]) >= [Min Date] && MAX('Product'[Date]) <= [Max Date], 1, 0)

And I have applied this measure as a visual level filter to the bar chart and choose "is 1". Then the bar chart becomes blank even there should be data. If I choose 0, it shows all data back.

 

Please could anyone tell me what's wrong with my flag measure? Thank you!
(Sorry that I cannot share any data as this is company computer)

 

 

4 REPLIES 4
Selva-Salimi
Super User
Super User

Hi @superhayan 

 

Are you sure that all your sales data is between these two dates?! it seems that it is not, so that you see blank.

you need to update your measure as follows:

 

Flag_within period = IF(selectedvalue('Product'[Date]) >= [Min Date] && selectedvalue('Product'[Date]) <= [Max Date]10)

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly. 

Sorry that it still doesn't work. The chart goes blank after I selected the filter to 1.

The sales data is from Oct 2024 to Sep 2025 so it is within the period I choose.

@superhayan 

 

now, I see that you have written "Min Date = max('Calendar'[date])" in your code. why did you write max instead of min?! the problem may happened because of that! if not please share some details

Anonymous
Not applicable

Hi @superhayan 

 

Thanks for the reply from @Selva-Salimi .

 

@superhayan , the following testing is for your reference.

 

My sample:

 

Product table:

vxuxinyimsft_0-1727146306071.png

 

Calendar Table:

vxuxinyimsft_1-1727146353919.png

 

Create a measure as follows

Measure = 
VAR _MinDate = SELECTEDVALUE('Calendar'[date])
VAR _MaxDate = EOMONTH(_MinDate, 2)
RETURN
IF(SELECTEDVALUE('Calendar'[Date]) = BLANK(), 1, IF(SELECTEDVALUE('Product'[Date]) > _MinDate && SELECTEDVALUE('Product'[Date]) < _MaxDate, 1, 0))

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_2-1727146420245.png

 

Output:

vxuxinyimsft_3-1727146441387.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.