Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi, i am trying to generate a column based on values coming from a different table.
Situation is as below:
There is a link from "Location Code" to "Location" (one to many).
Now, based on "Location" and "Asset Type" the formula should check the Lookup table and return back a number (Performed in Excel with functions INDEX and MATCH).
How can this be achieved through DAX please?
Maybe i should build the Lookup table differently? Any ideas?
Solved! Go to Solution.
Following formula should also give same results
Column = LOOKUPVALUE ( UnpivotedTable[Value], UnpivotedTable[Attribute], MainTable[Asset type], UnpivotedTable[Location Code], MainTable[Location] )
Hi@satlasg
Just Unpivot your columns in LookUpTable (all columns other than Location Code)
Then you can use this calculated column formula in your Table with New Column
=Related(LookupTable[Values])
Hi @Zubair_Muhammad,
tried the Unpivot but it couldnt possibly work, since it creates duplicates, so cannot build relation.
Any idea what am i doing wrong?
After UnPivot, i am left with those two unrelated tables:
Cannot create a LookupValue funtion that will bring me the corrensponding Value in the first table.
Hi @satlasg
Try this Calculated Column in your MainTable
(i.e. after unpivoting the LookUpTable)
Please change TableNames according to your case
Column = CALCULATE ( FIRSTNONBLANK ( UnpivotedTable[Value], 1 ), FILTER ( UnpivotedTable, UnpivotedTable[Attribute] = MainTable[Asset type] && UnpivotedTable[Location Code] = MainTable[Location] ) )
Following formula should also give same results
Column = LOOKUPVALUE ( UnpivotedTable[Value], UnpivotedTable[Attribute], MainTable[Asset type], UnpivotedTable[Location Code], MainTable[Location] )
Great, thank you, both work, the second looks more straightforward.
Just a note, in the first one, changing the second attribute of FIRSTNONBLANK to either 0, 2, 3, or even "" does not seem to have an effect.
I am trying to do the same, any chance you can share an example file please.
Many thanks
Paul
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
118 | |
75 | |
46 | |
44 | |
34 |
User | Count |
---|---|
179 | |
89 | |
69 | |
47 | |
47 |