Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
zudar
Post Patron
Post Patron

Variable factor in a calculated column

Hi all,

 

I could use some help with the following..

 

This is my model:

 

model2.JPG

 

 

The data looks like:

 

tables4.JPG

 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:

 

result3.JPG

 

 

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:

 

result4.JPG

Does anyone have idea how to make this work (with the final result being a calculated column)?

Help is very much appreciated. 🙂 

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @zudar ,

 

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.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
az38
Community Champion
Community Champion

Hi @zudar 

try a measure

Measure = SELECTEDVALUE(Factor[Factor]) * MAX(Products[YearlySales])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Wimverh
Resolver IV
Resolver 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/

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.