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
Saxon10
Post Prodigy
Post Prodigy

“DAX comparison operations do not support comparing values of type Integer with values of type Text.

 

I have two tables one is data and another one is report.

 

Data Table:

 

In data table the following columns are Item, A1, B1 and C1, item column stored as a text and remaining columns are (A1, A2,A3) are stored as a number.

 

ITEM      A1          A2          A3

123        10           20           30

124        40           50           60

125        70           80           90

126        100        110        120

127        130        140        150

128        160        170        180

129        190        200        210

130        220        230        240

131        250        260        270

 

Report Table:

 

In Report table contain item column and it’s stored as a text.

 

ITEM

A1

B1

C1

STATUS

123

10

20

30

#ERROR

124

40

50

60

#ERROR

12

   

#ERROR

1323

   

#ERROR

12

   

#ERROR

1567

   

#ERROR

125

70

80

90

#ERROR

4677

   

#ERROR

6232

   

#ERROR

 

 

Relationship:

 

In between two tables the item column are common.

 

Result

 

I already pull the data (A1, A2 and A3) into report table according to the item.

I would like to build the status based on the 3 columns – A1, A2 and A3 but I am receiving the following error when I try to attempt switch function “DAX comparison operations do not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values”.

 

Can you please advise were I need to modify the DAX formula? In lookup value function or switch function/?

 

 

A1 = LOOKUPVALUE(DATA[A1],DATA[ITEM],REPORT[ITEM])

 

B1 = LOOKUPVALUE(DATA[A2],DATA[ITEM],REPORT[ITEM])

 

C1 = LOOKUPVALUE(DATA[A3],DATA[ITEM],REPORT[ITEM])

 

STATUS = SWITCH(TRUE(),REPORT[A1]=0,"Not Okay", REPORT[A1]="","Not okay",REPORT[B1]=0,"Not Okay",REPORT[B1]="","Not Okay",REPORT[C1]=0,"Not Okay",REPORT[C1]="","Not Okay",REPORT[A1]>0,"Okay",REPORT[B1]>0,"Okay",REPORT[C1]>0,"okay")

 

Here is the PBI file for your reference https://www.dropbox.com/s/0n92kv5pol7zvb5/DAX%20comparison%20operations%20do%20not%20support%20compa...

 

 

 

 

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Saxon10 

It was the line REPORT[A1]="".  "" is a string, you have to use BLANK()

STATUS =
SWITCH (
    TRUE (),
    REPORT[A1] = 0, "Not Okay",
    REPORT[A1] = BLANK (), "Not okay",
    REPORT[B1] = 0, "Not Okay",
    REPORT[B1] = BLANK (), "Not Okay",
    REPORT[C1] = 0, "Not Okay",
    REPORT[C1] = BLANK (), "Not Okay",
    REPORT[A1] > 0, "Okay",
    REPORT[B1] > 0, "Okay",
    REPORT[C1] > 0, "okay"
)

jdbuchanan71_0-1621171905621.png

 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Saxon10 

It was the line REPORT[A1]="".  "" is a string, you have to use BLANK()

STATUS =
SWITCH (
    TRUE (),
    REPORT[A1] = 0, "Not Okay",
    REPORT[A1] = BLANK (), "Not okay",
    REPORT[B1] = 0, "Not Okay",
    REPORT[B1] = BLANK (), "Not Okay",
    REPORT[C1] = 0, "Not Okay",
    REPORT[C1] = BLANK (), "Not Okay",
    REPORT[A1] > 0, "Okay",
    REPORT[B1] > 0, "Okay",
    REPORT[C1] > 0, "okay"
)

jdbuchanan71_0-1621171905621.png

 

Thanks for your reply and your solution working well.

 

Thank you. 

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.