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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Do not count first sales date for each seller.

How is it going:

Along with greeting colleagues, I need to generate a measure that returns me to the "Total Sales" without accounting for those made on the first sale date that a seller has. I am using a Table visualization. I have the idea of capturing the minimum date for each seller using a VARIABLE, but I can't figure out how to use it later, so I get stuck.

I hope you will help me. In advance, thank you very much!.

Alfonso_Perez__0-1635301707792.png

Alfonso_Perez__1-1635301732585.png

In the case of the Seller of code 121, I do not want the sale made on "December 11, 2018" to be accounted for. And so for every seller.

Alfonso_Perez__2-1635301800212.png

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Syndicate_Admin , Try like

 

Measure =
VAR __id = MAX ('Table'[Seller ID] )
VAR __date = CALCULATE ( MIN('Table'[counter] ), ALLSELECTED ('Table' ), 'Table'[Seller ID] = __id )
CALCULATE ( Sum ('Table'[Sales] ), VALUES ('Table'[Seller ID] ),'Table'[Seller ID] = __id,'Table'[counter] = __date )

 

 

Or

sumx(Table, Firstnonblank(Table[Date], sum(Tables[Sales])))

 

or

Calculate(sumx(Table, Firstnonblank(Table[Date], sum(Tables[Sales]))), allexcept(Table, Table[seller id]))

 

refer

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @Syndicate_Admin ,

 

I think the suggestion provided by @amitchandak  and @Ashish_Mathur are worth a try. Please give feedback even on the results of the test.  If the problem has been solved, please mark the correct response as the standard answer to help the other members find it more quickly.

 

If the problem persists, please specify and provide the test data (remove sensitive information). I will get back to you as soon as possible.


Best Regards,
Henry

 

Ashish_Mathur
Super User
Super User

Hi,

Try this pattern

Date of first interaction = calculate(min(sales[date]),daesbetween(calendar[date],minx(all(calendar),calendar[date]),max(calendar[date])))

Total sale = sum(sales[value])

Total sale after first date = calculate([total sale],filter(values(Customers[Customer name]),sales[date]>[date of first interaction]))

To your visual, drag Year and Month name from the Calendar Table.  Drag the last measure to the visual.

If this does not help, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Syndicate_Admin , Try like

 

Measure =
VAR __id = MAX ('Table'[Seller ID] )
VAR __date = CALCULATE ( MIN('Table'[counter] ), ALLSELECTED ('Table' ), 'Table'[Seller ID] = __id )
CALCULATE ( Sum ('Table'[Sales] ), VALUES ('Table'[Seller ID] ),'Table'[Seller ID] = __id,'Table'[counter] = __date )

 

 

Or

sumx(Table, Firstnonblank(Table[Date], sum(Tables[Sales])))

 

or

Calculate(sumx(Table, Firstnonblank(Table[Date], sum(Tables[Sales]))), allexcept(Table, Table[seller id]))

 

refer

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear Amitchandak,

Thanks a lot! for your help so fast, I will test the code and tell you how it goes!

🙏

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.