Forum Discussion
Variable factor in a calculated column
Hi all,
I could use some help with the following..
This is my model:
The data looks like:
The table 'Factor' goes from 0,00 to 2,00 in increments of 0,01.
Now, I'd like to have a table with Products and a Yearly Sales (target) per product. The twist is that I'd like to add a variable 'factor' to the Yearly Sales:
In the example above, I have chosen for a factor of 0,72. This means the 'Result' should show a 'new' Yearly Sales like:
0,72*1000 for ProductID = 532
0,72*1500 for ProductID = 924
0,72*3000 for ProductID = 348
Now, I really need this resulting column to be a calculated column (not a measure). This has to do with further calculations I want to make. I thought this would be really simple by creating a calculated column like:
Yearly Sales (calc) = max(Factor[Factor])*Products[YearlySales]
However, this calculated column just fetches the maximum factor of 2,00, not taking my filter selection into account.
Alternatively, I tried creating a measure in 'Products' first that fetches the factor by:
Chosen Factor = max(Factor[Factor])
And then uses this measure in a calculated column:
Yearly Sales (calc 2) = Products[YearlySales] * [Chosen Factor]
But nothing I tried seems to work:
Does anyone have idea how to make this work (with the final result being a calculated column)?
Help is very much appreciated. 🙂
3 Replies
- WimverhResolver IV
It is impossible to use a column calculated by design for this requirement.
A computed column is calculated during table load and then stored in the model. Therefore, you cannot change based on a report parameter.
You have to redesign your other measurements, to work with a measure instead.
Explanation of the differences between calculated columns and measures:
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/ - az38Community Champion
Hi Anonymous
try a measure
Measure = SELECTEDVALUE(Factor[Factor]) * MAX(Products[YearlySales]) - AnonymousNot applicable
Hi Anonymous ,
As far as i know, the result of calculated column won't be affected by silcer. So you need to use measure or you can create a calculated table contains all values with different factors then use silcer to filter the table.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.