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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
emmyraldx
Regular Visitor

Can anyone help Convert this calculated column to measure

Hi guys, I have wanting to convert this calculated column to measure: 

 

IF(AND(AND(FctTable[CSDateTime] <> BLANK(), FctTable[CSDateTime] <= FctTable[EndDate]), FctTable[CSDateTime]<TODAY()), 1, IF(FctTable[CSDateTime] >=TODAY(), 2, IF( AND(FctTable[CSDateTime] > FctTable[EndDate], FctTable[CSDateTime] <=TODAY()), 3, IF(FctTable[CSDateTime] = BLANK(), 0))))

 

This is the closest I have but it's still incorrect:

 

IF(AND(AND(LEFT(MAX('FctTable'[CSDateTime]),20) <> BLANK(), LEFT(MAX('FctTable'[CSDateTime]),20) <=LEFT(MAX
('FctTable'[EndDate]),20)), LEFT(MAX('FctTable'[CSDateTime]),20) < LEFT(MAX(TODAY(),20))), 1,
IF(LEFT(MAX('FctTable'[CSDateTime]),20) >= LEFT(MAX(TODAY(),20)), 2,
IF( AND(LEFT(MAX('FctTable'[CSDateTime]),20) > LEFT(MAX('FctTable'[EndDate]),20), LEFT(MAX('FctTable'[CSDateTime]),20) <= LEFT(MAX(TODAY(),20))), 3,
IF(LEFT(MAX('FctTable'[CSDateTime]),20) = BLANK(), 0))))
 
Please help.
 
Emmyraldx
1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @emmyraldx 

You may try below measure:

Measure =
IF (
    AND (
        AND (
            MAX ( 'FctTable'[CSDateTime] ) <> BLANK (),
            MAX ( 'FctTable'[CSDateTime] ) <= MAX ( 'FctTable'[EndDate] )
        ),
        MAX ( 'FctTable'[CSDateTime] ) < TODAY ()
    ),
    1,
    IF (
        MAX ( 'FctTable'[CSDateTime] ) >= TODAY (),
        2,
        IF (
            AND (
                MAX ( 'FctTable'[CSDateTime] ) > MAX ( 'FctTable'[EndDate] ),
                MAX ( 'FctTable'[CSDateTime] ) <= TODAY ()
            ),
            3,
            IF ( MAX ( 'FctTable'[CSDateTime] ) = BLANK (), 0 )
        )
    )
)

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @emmyraldx 

You may try below measure:

Measure =
IF (
    AND (
        AND (
            MAX ( 'FctTable'[CSDateTime] ) <> BLANK (),
            MAX ( 'FctTable'[CSDateTime] ) <= MAX ( 'FctTable'[EndDate] )
        ),
        MAX ( 'FctTable'[CSDateTime] ) < TODAY ()
    ),
    1,
    IF (
        MAX ( 'FctTable'[CSDateTime] ) >= TODAY (),
        2,
        IF (
            AND (
                MAX ( 'FctTable'[CSDateTime] ) > MAX ( 'FctTable'[EndDate] ),
                MAX ( 'FctTable'[CSDateTime] ) <= TODAY ()
            ),
            3,
            IF ( MAX ( 'FctTable'[CSDateTime] ) = BLANK (), 0 )
        )
    )
)

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-cherch-msft 

Thank you v-cherch. It works. Really appreciate.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors