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.
Ok, here is the problem, I think this is easy but just didn't figure out the solution by myself.
I have two tables, which are related by Object. My problem is TABLE 1.
In TABLE 1 the Object can get four kind of status:
1. Applied
2. Viewed
3. Approved OR Rejected
I would like to add a column to TABLE 1 (green RESULT column below) which gives the number 3. result for all rows within the same Object. So when I select an object in visualization, it gives me immediately the information if the Object is Approved or Rejected. I could also use that as a filter to search rejected objects.
Any ideas? Thank you!
/Theiren
Solved! Go to Solution.
This is the correct code. Your code should be avoided because it's using CALCULATE in a calculated column and this - as is known - generates a lot of context transitions that slow down the code.
[Final Result] = -- calculated column var __object = T1[Object] var __hasBeenApproved = NOT ISEMPTY( FILTER ( T1, T1[Object] = __object && T1[Result] = "approved" ) ) retun if( __hasBeenApproved, "Approved", "Rejected" )
Best
Darek
[Final Result] = -- calculated column var __object = T1[Object] var __hasBeenApproved = NOT ISEMPTY( T, T1[Object] = __object && T1[Result] = "approved" ) retun if( __hasBeenApproved, "Approved", "Rejected" )
Best
D.
Thank you for your swift reply @Anonymous ! Function ISEMPTY seems to take only "Table" as a parameter, is there a typo in your dax?
/Theiren
This is the correct code. Your code should be avoided because it's using CALCULATE in a calculated column and this - as is known - generates a lot of context transitions that slow down the code.
[Final Result] = -- calculated column var __object = T1[Object] var __hasBeenApproved = NOT ISEMPTY( FILTER ( T1, T1[Object] = __object && T1[Result] = "approved" ) ) retun if( __hasBeenApproved, "Approved", "Rejected" )
Best
Darek
Thank you @Anonymous !!! It works now and I marked your reply as a solution. I am not prof enough to understand which actions slow down the code.
I also solved the slicer problem. For some reason if I used this new column as a slicer, it didn't work how I wanted (with info from other table), but when I brought the result to another table (where is only one object per row) it started to work. Thank you anyway! 🙂
/Theiren
I created the following DAX:
ResultColumn = var approved = CALCULATE(COUNTROWS(TABLE1), FILTER(TABLE1, EARLIER(TABLE1[OBJECT]) = TABLE1[OBJECT] && TABLE1[STAT] = "I6789")) return IF(approved > 0, "Approved", "Rejected")
This gives me the result I was hoping to get. BUT, I am still wondering how to create a slicer of this (i.e. if I want to see only rejected objects). Anyway, I will close this thread now and maybe return the second issue later if needed.
/Theiren
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |