The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I have 2 tables :
Table 1
Name | Version 1 | Version 2 |
A | 112 | 115 |
B | 112 | 115 |
C | 112 | 115 |
D | 112 | 115 |
E | 112 | 115 |
F | 112 | 115 |
G | 112 | 115 |
H | 112 | 115 |
Table 2:
Name | Version |
A | 112 |
B | 112 |
C | 116 |
D | 114 |
E | 115 |
F | 115 |
If in the same name, Table2[Version] = Table1[Version1] OR Table2[Version] = Table1[Version2] ==> OK , if not KO
The result will be like this :
Name | Version | Status |
A | 112 | OK |
B | 112 | OK |
C | 116 | KO |
D | 114 | KO |
E | 115 | OK |
F | 115 | OK |
Thank you in advance for your help.
Tg
You can achieve this by creating a calculated column in Table 1 that checks whether the conditions in Table 2 are met. Here's how you can do it step by step:
Step 1: Add a Calculated Column in Table 1
Assuming your tables are named "Table1" and "Table2," add a calculated column in "Table1" using the following DAX formula:
Status = VAR CurrentName = Table1[Name] VAR CurrentVersion1 = Table1[Version 1] VAR CurrentVersion2 = Table1[Version 2] VAR MatchedVersions = FILTER( Table2, Table2[Name] = CurrentName && ( Table2[Version] = CurrentVersion1 || Table2[Version] = CurrentVersion2 ) ) RETURN IF(COUNTROWS(MatchedVersions) > 0, "OK", "KO")
This formula checks if there are any matching rows in Table2 for the current row in Table1 based on the Name, Version1, or Version2 columns.
Step 2: Create a Result Table
You can create a new table in Power BI to display the final result. Go to "Modeling" > "New Table" and use the following DAX formula:
ResultTable = SUMMARIZE(Table1, Table1[Name], Table1[Version], Table1[Status])
This formula summarizes the results from Table1, including the "Name," "Version," and "Status" columns.
Step 3: Visualize the Result
Now, you can create a visual using the "ResultTable" to display the "Name," "Version," and "Status." If "Status" is "OK," it means the conditions in Table 2 are met; otherwise, it's "KO."
Your visual will display the desired result with "OK" and "KO" statuses for each row in Table1 based on the conditions you specified.
Thank you for your solution.
I would like to add the result directly to the Table 2 because I have many different tables to compare with table 1.
Table 2 would be like this :
Name | Version | Status |
A | 112 | OK |
B | 112 | OK |
C | 116 | KO |
D | 114 | KO |
E | 115 | OK |
F | 115 | OK |
Regards,
Tg
User | Count |
---|---|
69 | |
69 | |
66 | |
55 | |
28 |
User | Count |
---|---|
112 | |
82 | |
66 | |
48 | |
43 |