Forum Discussion
Adding a fixed value crashes my measure
Hi,
I'm trying to add a fixed value to my GP Per Lift measure. The measure below works, but if i add a fixed value of 3.5 it crashes my report.
This measure has a fixed value:
The below measure crashes my report.
Please find the link to my report below any help is much appreciated.
https://www.dropbox.com/s/n2fvokgrte5wvxg/Power%20BI%20Sample.pbix?dl=0
Returning constants from measures is generally a very bad idea. If you have 1000 customers 1000 products and 2 years worth of data (so 730 days) and you drag the product, customer and date onto a table with the operational cost measure the table will attemtp to return a row for every combination (so 1000 x 1000 * 730) which would be 730 million rows.
So I would suggest doing something like the following where you check if the measure is not blank before adding the constant value to it.
GP per Lift (excluding rent & doc) = VAR _operationCost = 3 VAR _part1 = [Lift Rate] - [Disposal Cost per Lift] RETURN IF( NOT( ISBLANK( _part1 ) ), _part1 + _operationCost )
1 Reply
- d_gosbell
Super User
Returning constants from measures is generally a very bad idea. If you have 1000 customers 1000 products and 2 years worth of data (so 730 days) and you drag the product, customer and date onto a table with the operational cost measure the table will attemtp to return a row for every combination (so 1000 x 1000 * 730) which would be 730 million rows.
So I would suggest doing something like the following where you check if the measure is not blank before adding the constant value to it.
GP per Lift (excluding rent & doc) = VAR _operationCost = 3 VAR _part1 = [Lift Rate] - [Disposal Cost per Lift] RETURN IF( NOT( ISBLANK( _part1 ) ), _part1 + _operationCost )