Forum Discussion
Saxon10
Post Prodigy
5 years agoSwitch statement with multiple conditions
Hi, I have two tables are Data and colour code. In data table and it’s contain the following columns are item, id type and colour code. In colour code table contain Id Type and Colour code. ...
- 4 years ago
Hi Saxon10
Thanks for the Excel sample. I realized my previous column formula has a logic error so it didn't get the correct result.
I used another method which is similar to the logic in your Excel file. It may be easier to understand. Download the pbix file below.
Code Text = LOOKUPVALUE('Colour code table'[Text],'Colour code table'[Id Type],'Table'[Id Type]) Unique Count = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Table','Table'[Item]=EARLIER('Table'[Item]) && 'Table'[Code Text]=EARLIER('Table'[Code Text])),"id_type",'Table'[Id Type]))) Result = IF('Table'[Code Text]="Not Pair" || 'Table'[Unique Count]=1, 'Table'[Colour Code], "Not Okay")Let me know if you have any questions.Regards,Jing
v-jingzhang
Community Support
4 years agoHi Saxon10
Thanks for the Excel sample. I realized my previous column formula has a logic error so it didn't get the correct result.
I used another method which is similar to the logic in your Excel file. It may be easier to understand. Download the pbix file below.
Code Text = LOOKUPVALUE('Colour code table'[Text],'Colour code table'[Id Type],'Table'[Id Type])
Unique Count = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Table','Table'[Item]=EARLIER('Table'[Item]) && 'Table'[Code Text]=EARLIER('Table'[Code Text])),"id_type",'Table'[Id Type])))
Result = IF('Table'[Code Text]="Not Pair" || 'Table'[Unique Count]=1, 'Table'[Colour Code], "Not Okay")
Let me know if you have any questions.
Regards,
Jing
Saxon10
Post Prodigy
4 years agoThanks for your reply and modifying the DAX formula according to Excel formula.
This is really amazing and easy to ready and understand the power BI functionality.
Much appreciated your help.
- v-jingzhang4 years ago
Community Support
You are welcome