Forum Discussion
IF with text value & AND OPERATOR
- 5 years ago
Hi All,
I am posting for others reference as the issue with AND operator is if it is to compare two different columns it works fine but when is to compare two values from same column the AND operator or IN operator doesnt work.
In such case you have to use nested IF.
Cheers.
schoden , if for the same set id (Device) if both are there
IF2 = if(countx(filter(Table, [device] =earlier([device]) && table[column] in { "Mobile Accessories", "Mobile Devices" }) ,[device])+0>=2, 1, 0)
Now if the can repeat you need to have a distinct count
IF2 = if( calculate(distinctcount(table[column]) , filter(Table, [device] =earlier([device]) && table[column] in { "Mobile Accessories", "Mobile Devices" }))+0>=2, 1, 0)
Both are new columns
Hi amitchandak
IF2 = if(countx(filter(Table, [device] =earlier([device]) && table[column] in { "Mobile Accessories", "Mobile Devices" }) ,[device])+0>=2, 1, 0)
Would you explain why [device ]+0>=2, at the end does ?
- schoden6 years ago
Post Partisan
Hi I used the first formual with opportunity ID which is same for the category of device and Accesssories, It returned the correct list but picked up some opportunity ID with just devices also still.
- schoden5 years ago
Post Partisan
Hi All,
I am posting for others reference as the issue with AND operator is if it is to compare two different columns it works fine but when is to compare two values from same column the AND operator or IN operator doesnt work.
In such case you have to use nested IF.
Cheers.
- schoden5 years ago
Post Partisan
Hi All ,
I thought I will share the best solution I found for my issue stated above. It works for any issue like one customers purchasing Product A and Product B ..Pretty much like What I was after.
After severel internet search, I found an article on Basket Analysis and a video tutorial :
https://www.youtube.com/watch?v=8PUNpVAiRAE
Cheers,
Have a good day.