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

Dynamic segments calculation for each month or week

Hello everyone!

 

This may be easily solved but I can't get my head around it. I have sales data which has shop ID, date, quantity, city etc. as shown below

hadiana_0-1732015408975.png

what I want to achieve in Power BI is the following, I want to create a table as shown below, where it sums unique shops by segments so for example 100 shops reside in 1/5 segment, and these segments are ordered from top to bottom (high sales to low).

so the first bucket which has 100 shops in it, it's also the most selling bucket as you see it has the highest sales, and then the rest of the calculation comes i.e. weighted sales (divide each segment with the total sales)

 

and also note I want to have a date filter and city for example when you choose November, everything should be calculated and reordered from scratch because some shops may have high sales in November but no sales in October 

 

hadiana_1-1732015456808.png

 

 for more context, this can be easily achieved in excel for example


1. you sumifs by Shop (you will have sales by shop)
2. then you will order them (high to low)
3. assign buckets to them
4. calculate for each bucket with IF conditions

 

2 REPLIES 2
Anonymous
Not applicable

I am thinking of whenever a month is filtered to create a dummy table that group sales by Shop IDs and ordered them from high to low and then assigns segments to them based on their percentage.

 

then in the table visual I just count the ID by segments cause it's already a distinct count of shops because it was grouped by shop id but I'm not sure how to achieve that.

Anonymous
Not applicable

Hi @Anonymous ,

 

As per my understanding, if I want to set date and city filters in the table, I have to add the date and city condition when calculating the total sales by shopid, is this right?please feel free to reply.

Total Sales by Shop = 
CALCULATE(
    SUM('Larger_Test_Sales_Data'[sales qty]),
    ALLEXCEPT('Larger_Test_Sales_Data', 'Larger_Test_Sales_Data'[shop ID],Larger_Test_Sales_Data[City],Larger_Test_Sales_Data[Date].[Month])
)

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors