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
Rena
Resolver II
Resolver II

If statement not working

I have a measure that finds the start period (12 months prior to latest date).  Which is returning a value of 53 (we are on month 66 right now).

 

Start Period =
   LOOKUPVALUE('Fiscal Map'[Period #],
    'Fiscal Map'[Date],
    MAX(
        'LEDS - SQL'[Fiscal_Week])
        )-13
 
Then I am doing a simple IF to include all periods that are greater than the start period
 
12 Months = IF([Period #]>[Start Period],"Include","Exclude")
 
The problems is - everything is "Include" (months 1 - 66) instead of just months 54-66. 
 
[Period #] is a whole number and [Start Period] is a whole number.
 
1 ACCEPTED SOLUTION
Rena
Resolver II
Resolver II

No clue why this works, but if I switch the formula to this it works just fine...

 

12 Months =

VAR StartPeriod =
    LOOKUPVALUE('Fiscal Map'[Period #],
    'Fiscal Map'[Date],
    MAX(
        'LEDS - SQL'[Fiscal_Week])
        )

RETURN
    IF([Period #]>(StartPeriod-13) && [Period #]<StartPeriod,
    "Include",
    "Exclude"
    )
 
 

View solution in original post

1 REPLY 1
Rena
Resolver II
Resolver II

No clue why this works, but if I switch the formula to this it works just fine...

 

12 Months =

VAR StartPeriod =
    LOOKUPVALUE('Fiscal Map'[Period #],
    'Fiscal Map'[Date],
    MAX(
        'LEDS - SQL'[Fiscal_Week])
        )

RETURN
    IF([Period #]>(StartPeriod-13) && [Period #]<StartPeriod,
    "Include",
    "Exclude"
    )
 
 

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.