Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Need Alternative for 'Value' function

Hi Team,  I am facing an issue by using 'Values' as function in one my Query. My Query: (Measure) Year-Month = IF(values(Process_level) ="K10 Invoiced",IF(Month(TODAY())>3 ,(Month(TODAY())-3)*[Tar...
  • SteveCampbell's avatar
    7 years ago

    Just to fully understand, can I confirm a few things -

    I am assuming " Process_level " is the name of a colmn? so it would be something like, Table1[Process_level] ?

    Are you adding to this to a table of visual, then [Process_level] this being used in a slicer?

     

    The problem is that values returns a table, a distinct list of all values. So if you have selected multiple, you are asking if a table equals the string value of "K10 Invoiced". SELECTEDVALUE could do the trick, and I would use a variable:

     

    Year-Month =
    VAR _Process_level =SELECTEDVALUE ( [Process_level] )
    
    RETURN
    IF ( _Process_level = "K10 Invoiced", IF ( MONTH ( TODAY () ) > 3, ( MONTH ( TODAY () ) - 3 ) * [Targets], ( MONTH ( TODAY () ) + 9 ) * [Targets] ), [Targets] )