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
rajk
Regular Visitor

If Condition Performance Issues

I had to use a filter with IF condition. It is not performing and report fails. With out the filter the report runs fine. 

Filter = if(and(SELECTEDVALUE('Table [Column])>=DATE(YEAR(TODAY()), MONTH(TODAY())-3, 1)  , SELECTEDVALUE('Table [Column])<=TODAY()-1),"Yes","No")
Basically We wanted last three months and day 1 of the month and Yesterday dynamically. 
If we look at today it would be 12/1/2023 - 3/20/2024.
 
Any Help please..!
5 REPLIES 5
Anonymous
Not applicable

Hi @rajk ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

We are on Fabric with schematic model.

Anonymous
Not applicable

Hi @rajk,

Perhaps you can try to use IN operator to check if the current date are included in specific ranges:

formula =
VAR currDate =
    MAX ( 'Table1'[Column] )
VAR _range =
    CALENDAR ( DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 3, 1 ), TODAY () - 1 )
RETURN
    IF ( currDate IN _range, "Yes", "No" )

The IN operator in DAX - SQLBI

If the aboe not help, can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,
Xiaoxin Sheng

gmsamborn
Super User
Super User

Hi @rajk 

 

Would a measure like this help?

 

Filter = 
    IF(
        SELECTEDVALUE( 'Sheet1'[Date] ) >= EOMONTH( TODAY(), - 4 ) + 1
            && SELECTEDVALUE( 'Sheet1'[Date] ) <= TODAY() - 1,
        "Yes",
        "No"
    )

 

 

Let me know if you have any questions.

 

test IF perf.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

I had same thing but report fails. Even I added dates manually like 12/1/2023 and 3/26/2023, .. But report fails after running for some time. unbale to figure out where the performance issue is. Or an alternative for IF which is better performing. 

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.