Forum Discussion

Ssibbett's avatar
Ssibbett
Frequent Visitor
6 years ago

DAX Selectvalue() does not work with Dynamic Calculation Columns

Hello, 

I'm new to power BI. 

I have created table "Units" that has two choices (below). This is used in a Slicer. 

Selected UnitsChoice
Acre-Feet1
Million Galons2

I have a measure with formula: Units Value = LOOKUPVALUE(Units[Choice],Units[Select Units], SELECTEDVALUE(Units[Select Units],"Million Gallons"))

The information for the measure displays correctly on the Card. 

I have another table "Volumes" with volumes and various units for volumes. I want to allow the user to choose one unit type from "Units" table for the report display. I added a New Column to the "Volumes" table with the formula: 

Volumn UOM = SWITCH(Units[Units Value],1,[To AF]*[Volume],2,[To MG]*[Volume],0).
The report will result in the alternative "Million Gallons" dispite changes to the slicer. The Card does change values with the slicer. If I change SELECTEDVALUE(Units[Select Units],"Acre-Feet") then the report will be in "Acre-Feet". 
 
I have also tried using parameter for the same purpose but the results are the same. I have also tried using the formula: Units Value =  LOOKUPVALUE(Units[Choice],Units[Select Units], IF(HASONEVALUE(Units[Select Units]),VALUES(Units[Select Units]))), but that does not work. 
 
I believe this should work because there are some article that say so, https://spr.com/powerbi-dynamic-calculations/ 
 

 

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Columns are not dynamic, they are calculated at data load so they cannot change when you change a slicer. You need a measure.

    • Ssibbett's avatar
      Ssibbett
      Frequent Visitor

      If I put the column formula in a measure, the measure will not calculate values for each row. 

      Here is my column formula Volumn UOM = SWITCH(Units[Units Value],1,[To AF]*[Volume],2,[To MG]*[Volume],0).  How do I make this into a measure?