Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

SQL to DAX

Hello everyone.   I need to extract the single value of a cell from a table and showcase it. My initial thoughts are to write a DAX query and assign it to a measure.    However, I'm not sure of h...
  • Vvelarde's avatar
    9 years ago

    Helllo Anonymous

     

    try with:

     

    Measure= Calculate(Values(Table[Col1]),Filter(Table,Table[Col2]="x" && Table[Col3]="y"))

  • v-ljerr-msft's avatar
    v-ljerr-msft
    9 years ago

    Hi Anonymous,

     

    Have you tried the measure provided by Vvelarde? It should work.

     

    In addition, just in case there may be multiple values returned with the condition of the filter, we can add FIRSTNONBLANK Function (DAX) within the measure in this scenario.:smileyhappy:

    Measure =
    CALCULATE (
        FIRSTNONBLANK ( VALUES ( 'TableName'[Col1] ), 1 ),
        FILTER ( 'TableName', 'TableName'[Col2] = "x" && 'TableName'[Col3] = "y" )
    )

    Regards