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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
AllanBerces
Post Prodigy
Post Prodigy

IF

Hi to all, 

Can someone help me to edit my measure to add IF condition from the current measure, I have a table with column of Week no. What i need is if the value is lessthan this week make it zero.

 

_5 Delta PY Line Negative AC = IF([_5 Delta PY] <0, [_5 Delta PY Line] + [_5 Delta PY], BLANK())
 
Thank you
1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

Hi @AllanBerces ,

You can achieve the desired result by using this DAX:

_5 Delta PY Line Negative AC =
VAR CurrentWeek = MAX(DateTable[Week No])  -- Get the current week number
RETURN
    IF(
        MAX(DateTable[Week No]) < CurrentWeek,  -- Check if the week is less than the current week
        0,  -- Set the value to zero
        IF(
            [_5 Delta PY] < 0, 
            [_5 Delta PY Line] + [_5 Delta PY], 
            BLANK()
        )
    )

View solution in original post

3 REPLIES 3
Bibiano_Geraldo
Super User
Super User

Hi @AllanBerces ,

You can achieve the desired result by using this DAX:

_5 Delta PY Line Negative AC =
VAR CurrentWeek = MAX(DateTable[Week No])  -- Get the current week number
RETURN
    IF(
        MAX(DateTable[Week No]) < CurrentWeek,  -- Check if the week is less than the current week
        0,  -- Set the value to zero
        IF(
            [_5 Delta PY] < 0, 
            [_5 Delta PY Line] + [_5 Delta PY], 
            BLANK()
        )
    )

hi @Bibiano_Geraldo @Uzi2019 Thank you very much for the reply, work as i need.

Uzi2019
Super User
Super User

Hi @AllanBerces 

 

Can you share the sample data and expected output??

 

would be better for us to understand your scenario.

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.