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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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