Forum Discussion
DAX Calculate is calculating wrong lines
Hi
I am trying to calculate different fuel quantity losses using the DAX calculate. Problem is that it is also calculating the lines that are not relevant for the specific fuel type.
We have IFO, MGO, LSGO and ULSFO/VLSFO
Ex. the IFO loss calculation is:
Another issue is how i get the IFO loss % only to divide if the denominator or nominator has a number otherwise come blank.
I hope you can help.
8 Replies
- AnonymousNot applicableIn your calculate dax you have not added any filter.
The expression should be like
Calculate(sum(table[amount]),filter(table,table[type]="IFO"))
THANKS
PRAVIN
If it resolves your problem mark it as a solution and give Kudos.- bunkertrustFrequent Visitor
Hi Pravin,
So you mean:
IFO Loss MT = calculate(SUM('bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_received_vessel_figure]), FILTER('bunkertrust_com_db vBunkerOperationsFirstView', 'bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_received_vessel_figure]="IFO")) - CALCULATE(SUM('bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_departure_bdn]))))This comes with syntax is incorrect- AnonymousNot applicable
You have added to many parenthesis.
try this
IFO Loss MT = calculate(SUM('bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_received_vessel_figure]), FILTER('bunkertrust_com_db vBunkerOperationsFirstView', 'bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_received_vessel_figure]="IFO")) - CALCULATE(SUM('bunkertrust_com_db vBunkerOperationsFirstView'[bunker_ifo_departure_bdn]))
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
- AnonymousNot applicable
for Loss %, you can simply use ISNUMBER() DAX function to check whether a number is valid or not. If condition satisfies, you can use DIVIDE() function to calculate final loss %