Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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)
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], 1, 0)
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.
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
Hi @superhayan
Thanks for the reply from @Selva-Salimi .
@superhayan , the following testing is for your reference.
My sample:
Product table:
Calendar Table:
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.
Output:
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |