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
hellohelpme
New Member

Create a table that collects the count every day (data refreshed daily)

Hello! I have a data table that logs food in a store. All food types has an expiry date, and the original table include both food that is expired and food that is still good. The dataset is refreshed every day, which means that new items of food can come in and food can expire. 

 

I want to create a table that collects the count of food that is not expired every day from today. It does not have to go back in time, but if I could start collecting the counts today (or one of the following days), I would soon get a good overview of how the stock of non-expired food develops over time. 

 

I have tried to create a calendar-table and add the following column: 

foodstock=if(table[Date]=TODAY(), count(foodsupply[foodID]))

 

This collects the count for todays date, but the next day it "overwrites" the day before to blank: 

 

Example: 

On March 1st it gives me this: 

Datefoodstock
01.03.20239083
02.03.2023 
03.03.2023 
04.03.2023 

 

On March 2nd it gives me this: 

Datefoodstock
01.03.2023 
02.03.202313045
03.03.2023 
04.03.2023 
 
I wish it could give me this: 
Datefoodstock
01.03.20239083
02.03.202313045
03.03.2023 
04.03.2023 

 

Any ideas on how I can solve this? 

1 REPLY 1
Anonymous
Not applicable

Hi @hellohelpme ,

 

Please try this.

foodstock = IF('table'[Date]<=TODAY(),CALCULATE(COUNT('foodsupply'[foodID]),RELATEDTABLE('foodsupply')))

 

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 in the Power BI Forum

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.

Top Solution Authors