Forum Discussion
rhinorocks
4 years agoFrequent Visitor
Defining Variables
Hi All, I am new to Dax and currently facing issues in defining variables. Can we define table columns in Variable? Like I have a Table called Customer Master and I want to define a variable...
- 4 years ago
I think I got the solution of this issue. I was trying to write a measure instead of the calculated column.
Syk
Resident Rockstar
4 years agoYou can work with columns in DAX but your measure has to return a scalar value. For example, in the dax below I'm storing a column in a variable but returning the sum of the column. If you reply with your specific use case, we may be able to help in more detail!
measure =
var sales = 'sales'[sales_amount]
return sum(sales)
- krzlag3 years agoNew Member
Hi Syk, I build similar logic, but it doesn't work
Syk wrote:You can work with columns in DAX but your measure has to return a scalar value. For example, in the dax below I'm storing a column in a variable but returning the sum of the column. If you reply with your specific use case, we may be able to help in more detail!
measure = var sales = 'sales'[sales_amount] return sum(sales)