Forum Discussion
ASchulz
2 years agoNew Member
How to Create a column that references another column value and NOT the data table
I have a table that I am having difficulty with. In the below table, my Locations and Plt Cap columns are not summing up because I had to use the Minimum calculation to get the value I want in the rows.
The code that I used for locations is this:
LocationsForProductTypeTable = If([Product Type] = "NON-HAZ (Mezz)", 13, If([Product Type] = "NON-HAZ (A's)", 300, If([Product Type] = "Haz", 220, If([Product Type] = "Candle",5, 1))))
The problem is that all I want is in THIS SPECIFIC TABLE, if the Product Type is Candle, I want THIS SPECIFIC COLUMN on this table to show the value of 5. Is this something possible that I can do in Power BI?
The solution to this lied within adding this code as a seperate measure
SumOfMaxLocations =SUMX(SUMMARIZE(Query1, [Product Type],[LocationsForProductTypeTable]),[LocationsForProductTypeTable])
2 Replies
- Martin_DSolution Sage
Assuming [Product Type] is a column of table MyTable, then the following measure would do the job:
Locations = IF(SELECTEDVALUE(MyTable[Product Type])="Candle",5)
Then add the measure to your visual. - ASchulzNew Member
The solution to this lied within adding this code as a seperate measure
SumOfMaxLocations =SUMX(SUMMARIZE(Query1, [Product Type],[LocationsForProductTypeTable]),[LocationsForProductTypeTable])