Forum Discussion
Marek_Wojciech
3 years agoFrequent Visitor
optimization of measure codes
Hello, I would like to ask about some tips on how I could optimize the code I wrote for the following issue to make it work faster (currently it takes far too much time): I have a variable th...
amitchandak
Super User
3 years agoMarek_Wojciech , Can you create another measure like,
CALCULATE(SUMX(Daty,
Switch( True(),
[Moc_2]=Blank(),[Moc_3],
[Moc_2])=0&&[Moc_3]>0,1,
[Moc_3]=0&&[Moc_4]>0,1,
//Addother
))
Another way to unpivot and have single condition
Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g
Also we can have table like
Sumx({[Col1], [Col2], [Col3]}, if( [Value] >1, 1,blank())
Add all column in {}
Marek_Wojciech
3 years agoFrequent Visitor
Thanks for all suggestions. I used the second one related to unpivoting facts’ table. I had to add a calculation column in the table. I thought of that before, but many power-users were not recommending such solution. As a result, query computing time decrased from 30 s to 0.5 s. Other suggested hints on modofying DAX code did not work out.