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! Request now

Reply
yshmelev
Frequent Visitor

Dynamic calculation of each row by month

Hello!

 

I want to create a chart in Power BI, but cannot find a right approach to do that.

 

I have a list of products with unique product ids. Each product_id has a field with arrival date, current status (if it's sold or not) and when it was sold (arrival date + days_in_store_before_sold). I want to show sales by month (or even by week), but each month/week should show 3 categories: if a product is sold during current month, if it is in store less than 30 days or if it's in store more than 30 days.

 

Data sample:

product_unique_idstatusarrived_to_storedays_in_store_before_soldresponsible_personnote_for_understanding
apple-green-123sold01/05/20225Kenin store Jan, sold Jan
peach-123sold01/10/202210Mikein store Jan, sold Jan
watermelon-123sold01/20/202230Mikein store Jan, sold Feb
apple-red-999999in store01/07/2022n/aMikein store Jan, not sold
watermelon-123sold02/02/202210Mikein store Feb, sold Feb
peach-999999999sold02/05/202235Kenin store Feb, sold Mar
peach-123in store03/03/2022n/aMikein store Mar, not sold

 

At the end I want something like that:

yshmelev_0-1667239806447.png

There are other fields, such as responsible_person, that show specific product attributes. That's why I don't want to remove it, I will need to put them as filters on the chart in the future.

 

As you can see, it's very dynamic from month to month. For example, apple-red-999999 is in "In store (0-30 days)" group in "end of January", but should be "In store (30+ days)" group in every other month after January (because it has never been sold). Same with peach-999999999: it's "In store (0-30 days)" by the end of February, but in "Sold" category by the end of March.

 

The chart is probably not the biggest problem, I'm struggling to find a way to create measures/columns to use in my final chart. Could you please advise me the right approach to achieve this? Or any links that cover similar cases...

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @yshmelev ,

Please check the pbix pile.

vcgaomsft_0-1667290526599.png

If I have misunderstood your needs, please feel free to contact me, it would be nice to have the calculation logic.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @yshmelev ,

Please check the pbix pile.

vcgaomsft_0-1667290526599.png

If I have misunderstood your needs, please feel free to contact me, it would be nice to have the calculation logic.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

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.