cancel
Showing results for 
Search instead for 
Did you mean: 
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

 

View solution in original post

Thanks for your reply and your solution working well.

 

Thank you. 

Helpful resources

Announcements
Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Power BI Womens Summit 2021 768 x460.jpg

Interviews, learning sessions, allies, and more!

#PowerBIWomenSummit

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!