Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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:
| Date | foodstock |
| 01.03.2023 | 9083 |
| 02.03.2023 | |
| 03.03.2023 | |
| 04.03.2023 |
On March 2nd it gives me this:
| Date | foodstock |
| 01.03.2023 | |
| 02.03.2023 | 13045 |
| 03.03.2023 | |
| 04.03.2023 |
| Date | foodstock |
| 01.03.2023 | 9083 |
| 02.03.2023 | 13045 |
| 03.03.2023 | |
| 04.03.2023 |
Any ideas on how I can solve this?
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 67 | |
| 31 | |
| 27 | |
| 24 |