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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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