Forum Discussion
Anonymous
5 years agoNot applicable
summing qty using two different columns
Hi everyone . i need help . I need to sum the qty of vehicles of each quotation, but only for the first revision .
i marked in blue those ones that need to sum, the earliest revision of each quotation. then to group by month
there are quotations (7052, revision 0) that started in august, so the revision of september (7052-1) must be ignored for example.
i tried this dax command,
_SomaMaxRevisao = SUMX(VALUES(Planilha1[QuotationID]),
CALCULATE(SUM(Planilha1[Vehicle QTY]),
ALLEXCEPT('Planilha1', Planilha1[QuotationID]),
FILTER(ALL
(Planilha1[Revision]), Planilha1[Revision] = CALCULATE(MIN(Planilha1[Revision]),ALLEXCEPT('Planilha1',Planilha1[QuotationID])))))
however, when i group by month, it considers the earliest revision of the month. It Counts 7052-0 as the earliest of august and 7052-1 as the earliest of september. this is not appropriated . I need to only count of august s the previous month
how can i solve that issue in a dax measure ?
1 Reply
- wdx223_DanielCommunity Champion
SUMX(VALUES(Planilha1[QuotationID]),VAR _c=Planilha1[QuotationID] RETURN MAXX(TOPN(1,FILTER(Planilha1,Planilha1[QuotationID]=_c),Planilha1[Revision],ASC),Planilha1[Vehicle QTY]))