Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I am trying to create a new column as follows:
DeductionFlag =
SWITCH(TRUE(),
CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"IN") && CONTAINSSTRING(RELATED(FareReduction[FareReductionCode]),"AD"),1,
CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"AD") && NOT( CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"AD50")),1,
CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"ID") && NOT( CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"ID50")),1,
CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"BP") && NOT( CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"BPR")),1,
RELATED(IATAFareBasis[iatafarebasisCode]) = "Y" || RELATED(IATAFareBasis[iatafarebasisCode]) = "N",1,
RIGHT(RELATED(IATAFareBasis[iatafarebasisCode]),2)= "DH",1,
CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"RG90") || CONTAINSSTRING(RELATED(IATAFareBasis[iatafarebasisCode]),"RG75"),1,
RELATED(FareReduction[FareReductionCode]) = "IN" || RELATED(FareReduction[FareReductionCode]) = "TS" || RELATED(FareReduction[FareReductionCode]) = "PS",1,
Related(FareType[FareTypeKey]) = 55 || related(FareType[FareTypeKey]) = 134,1,
'Pax Revenue'[PAX_Rev excl_YQ ( EUR )] =0 ,1,
0)
Basically, I need that deduction flag to build measures in the model.
However, I am encountering a memory issue when the above code runs.
The culprit seems to be 'Pax Revenue'[PAX_Rev excl_YQ ( EUR )] =0 ,1, which makes my laptop run out of memory.
When I remove this condition the rest of the code works fine and I have no memory issue.
[PAX_Rev excl_YQ ( EUR )] is a calculated column in one of my fact Tables.
Is there any way I can resolve the above apart from adding more memory to my laptop?
Thanks
Veemal
Solved! Go to Solution.
@VeemalS can you use variables and store the calculation results in variables and try using variables inside SWITCH?
The code has been changed as follows:
@VeemalS can you use variables and store the calculation results in variables and try using variables inside SWITCH?
The code has been changed as follows:
Hi,
Regarding optimization, this kind of formula is extremly "heavy". RELATED and CONTAINSSTRING are some of the more non-optimized formulas and calculated columns are not optimal in terms of memory usage. If possible I would try to apply your desired logic into a formula. To do this a more clarified explanation on what you are trying to achieve is required.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
53 | |
27 | |
24 | |
14 | |
9 |
User | Count |
---|---|
76 | |
58 | |
47 | |
17 | |
12 |