Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not 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 

dsplaymaxxis_0-1630881647195.png

 

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 1
wdx223_Daniel
Super User
Super User

SUMX(VALUES(Planilha1[QuotationID]),VAR _c=Planilha1[QuotationID] RETURN MAXX(TOPN(1,FILTER(Planilha1,Planilha1[QuotationID]=_c),Planilha1[Revision],ASC),Planilha1[Vehicle QTY]))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.