Forum Discussion
Sum a multiplication with if
- 6 years ago
Anonymous Try like. maxx
sumx(SUMMARIZE(ARTICLES;ARTICLES[ART_code];"M1";maxx(ARTICLES;if('ARTICLES'[ART_PRI]<>0; 'ARTICLES'[ART_PRI];'ARTICLES'[ART_PRI_Exact])); "M2";sum('TRANSACTION'[V_qte]));[M1]*[M2])
Hi amitchandak ,
thank you for your answer. I am not sure I understood it. I put :
sumx(SUMMARIZE(ARTICLES;ARTICLES[ART_code];"M1";max(ARTICLES;if('ARTICLES'[ART_PRI]<>0; 'ARTICLES'[ART_PRI];'ARTICLES'[ART_PRI_Exact]));"M2";sum('TRANSACTION'[V_qte]));[M1]*[M2])but I have 2 errors :
Anonymous Try like. maxx
sumx(SUMMARIZE(ARTICLES;ARTICLES[ART_code];"M1";maxx(ARTICLES;if('ARTICLES'[ART_PRI]<>0; 'ARTICLES'[ART_PRI];'ARTICLES'[ART_PRI_Exact]));
"M2";sum('TRANSACTION'[V_qte]));[M1]*[M2])
- Anonymous6 years agoNot applicable
Hi amitchandak
thank you for your quick answer ! 🙂 I had an error first with MAXX that's why I put only MAXX (did not understand there were 2 different functions, sorry). I have no more error on the measure but it can't be shown on the screen : there is another error "la fin de l'entrée a été atteinte" which could be translated by "the end of the entry has been reached". Any idea ?
thank you very much,
Delphine
- Anonymous6 years agoNot applicable
amitchandak I got it : I am multiplicating a reference with a price... 😥 Let me try to fix it, and I tell you.
- Anonymous6 years agoNot applicable
Hi amitchandak , I tried to do it step by step to understand where could the errors come from and it still doesn't work : even the IF function returns me an error "cannot find name" while I followed the example given there if function dax microsoft docs
if([ART_PRI]<>0;[ART_PRI];[ART_PRI_Exact])and "impossible to have one unique value"
if(ARTICLES[ART_PRI]<>0;ARTICLES[ART_PRI];ARTICLES[ART_PRI_Exact])or
if('ARTICLES'[ART_PRI]<>0;'ARTICLES'[ART_PRI];'ARTICLES'[ART_PRI_Exact])(I still don't understand why sometimes you have ' before and after the name of the table, and sometimes you don't).
The COG calculation is supposed to be one of my simplest calculations, I am quite afraid for the other ones I have to do 😢
thank you very much for your help !