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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.