Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Assign Column Value to a Variable

Hi,    I am trying to create a variable that contains the values in one of my table columns. For example, I have column called Category Number which assigns a text column a number ranging from 1-13...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    VALUES() function returns a table.

    You could add a column or create a measure to get the sum of sales:

    Column = CALCULATE(SUM('2021_Data'[Sales]),FILTER('2021_Data',[CAT]=EARLIER('Table'[CAT])))
    
    Measure = CALCULATE(SUM('2021_Data'[Sales]),FILTER('2021_Data',[CAT]=MAX('Table'[CAT])))
    

    Output:

     

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.