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
surajde
Helper I
Helper I

Expression that yeild variant data-type error

Hi All,

 

Need your help with below data type where I'm getting error when trying to apply a dax on Met as a conditional column. 

 

Sample Data: 

OPENED_DATE_CSTRESTORED_DATE_CSTCLOSED_DATE_CSTTICKET_STATETTR_HoursTarget (Hours)Days to Due DateMet
12/1/21 12:02 AM12/2/21 12:39 PM12/7/21 12:41 PMClosed12.83168.007.00 
12/1/21 12:31 AM12/14/21 2:38 PM12/19/21 5:12 PMClosed62.54168.007.00 
12/1/21 12:59 AM12/3/21 12:36 PM12/8/21 12:40 PMClosed35.46168.007.00 

 

surajde_0-1681397063514.png

When I created a calculated column for last condition to avoid addition of dates then received another error: 

surajde_1-1681397175693.png

 

 

1 ACCEPTED SOLUTION

Try

Met =
IF (
    'AOTS Daily CSL 54 1'[TICKET_STATE] = "Cancel",
    "NA",
    IF (
        OR (
            'AOTS Daily CSL 54 1'[TICKET_STATE] = "Closed",
            'AOTS Daily CSL 54 1'[TICKET_STATE] = "Ready to Close"
        ),
        IF (
            'AOTS Daily CSL 54 1'[TTR_Hours] <= 'AOTS Daily CSL 54 1'[Target (Hours)],
            "1"
        ),
        IF (
            'AOTS Daily CSL 54 1'[OPENED_DATE_CST] + 'AOTS Daily CSL 54 1'[Days to Due Date]
                > TODAY (),
            "TBD",
            "0"
        )
    )
)

View solution in original post

4 REPLIES 4
surajde
Helper I
Helper I

Hi @johnt75 , 

 

Please see below formula for GreaterThanOpenDue column. basically I then tried creating to avoid last calculation of dates 

 

Met =
    IF('AOTS Daily CSL 54 1'[TICKET_STATE]="Cancel","NA",
    IF(OR(
        'AOTS Daily CSL 54 1'[TICKET_STATE]="Closed",
        'AOTS Daily CSL 54 1'[TICKET_STATE]="Ready to Close"),
        IF('AOTS Daily CSL 54 1'[TTR_Hours]<='AOTS Daily CSL 54 1'[Target (Hours)],1),
        IF('AOTS Daily CSL 54 1'[OPENED_DATE_CST]+'AOTS Daily CSL 54 1'[Days to Due Date]>TODAY(),"TBD",0))
 

 

surajde_0-1681399176194.png

 

Try

Met =
IF (
    'AOTS Daily CSL 54 1'[TICKET_STATE] = "Cancel",
    "NA",
    IF (
        OR (
            'AOTS Daily CSL 54 1'[TICKET_STATE] = "Closed",
            'AOTS Daily CSL 54 1'[TICKET_STATE] = "Ready to Close"
        ),
        IF (
            'AOTS Daily CSL 54 1'[TTR_Hours] <= 'AOTS Daily CSL 54 1'[Target (Hours)],
            "1"
        ),
        IF (
            'AOTS Daily CSL 54 1'[OPENED_DATE_CST] + 'AOTS Daily CSL 54 1'[Days to Due Date]
                > TODAY (),
            "TBD",
            "0"
        )
    )
)

@johnt75  Bingo!! it worked!! 

 

Thanks a ton. You just solved my long pending query in a minute.

johnt75
Super User
Super User

Your calculated column would return either text or an integer depending on which condition is met, that's not allowed. Instead of returning 0 or 1 return "0" or "1".

For the second error, you need to check the type of the GreaterThanOpenDue column. If that is a boolean column then you need to remove the " around True in the IF statement.

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.