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.
Hello everyone!
I have two tables:
Table 1 (let's call it "Bank") has a code number for each registered bank and its name (it comes from our database);
Table 2 (let's call it "Plan") has a code number for each bank and a link to its logo image in google drive (it comes from an Excel file).
All codes in Plan are in Bank, but not all codes in Bank exist in Plan.
I need to create a calculated column in Plan that checks if the selected value in Bank exists in Plan. If it exists, then the column shows the corresponding link. If not, then it shows a specific link.
I am using the Simple Image visual to show the image, so the link column is marked as Image URL. This visual only accepts a column as value.
I have tried this dax expression:
Coluna = IF( SELECTEDVALUE(Bank[Code]) IN Plan; Plan[link]; "my-link" )
but I am getting an error saying that "function CONTAINSROW must have a value for each column in the table expression.
Anyone have any idea about how to solve this?
Thank you!
EDIT:
I tried this dax expression:
Coluna = IF( HASONEVALUE(Plan1[banco]); SELECTEDVALUE(Plan1[link 3]); "my-link" )
but it always shows the static link image, no matter if there is a corresponding image to the selected bank code.
Solved! Go to Solution.
@v-chuncz-msft thank you for your response!
I reached another solution, a bit more complicated, but it worked just fine
I created this calculated column in Bank, because I realized that my logic of creating it in Plan was wrong:
Coluna =
VAR CHECK =
CALCULATE (
COUNTROWS ( Plan ),
FILTER ( Plan, Plan[code] = EARLIER ( Bank[Code] ) )
) > 0
VAR LINK =
CALCULATE (
FIRSTNONBLANK ( Plan[link], Plan[link] ),
ALLEXCEPT ( Bank, Plan[code] )
)
RETURN
IF ( CHECK, LINK, "my-link" )
You may just use LOOKUPVALUE.
Column = LOOKUPVALUE ( Plan[link], Plan[Code], Bank[Code], "my-link" )
@v-chuncz-msft thank you for your response!
I reached another solution, a bit more complicated, but it worked just fine
I created this calculated column in Bank, because I realized that my logic of creating it in Plan was wrong:
Coluna =
VAR CHECK =
CALCULATE (
COUNTROWS ( Plan ),
FILTER ( Plan, Plan[code] = EARLIER ( Bank[Code] ) )
) > 0
VAR LINK =
CALCULATE (
FIRSTNONBLANK ( Plan[link], Plan[link] ),
ALLEXCEPT ( Bank, Plan[code] )
)
RETURN
IF ( CHECK, LINK, "my-link" )
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 |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |