Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
Thanks in advance for your help.
I have the following dataset:
Store-Number | Article-ID | Date (Year-Week) | Stock Value |
1000 1 2023-01 50
1000 2 2023-01 75
1000 1 2023-02 50
1000 2 2023-02 75
1001 1 2023-02 50
1001 2 2023-02 75
1001 1 2023-02 55
1001 2 2023-02 80
Stores are supposed to do a stock count every week. We're trying to determine whether the stores checked their total stock value each week (counted/priced all articles) based on the following logic:
Reasoning:
- If for one store-number, any of the article_id's changed in Stock Value, compared to the week before.
Expected Answer:
- In the example above, no stock-value changes happened for store 1000. We expect stock-count = 0 for that week.
For store 1001 we see that at least 1 item changed in price (therefore we want stock count = 1) for that week.
In total we should be able to determine the number of counts during a year, and divide that with the total number of years to get a percentage.
If any more info is needed, please let me know.
Hi @Justin_PowerBI
It is not so clear at total level if a store will be counted as many times as the weeks that have change or only once. The following counts for every week change.
Count =
COUNTROWS (
FILTER (
SUMMARIZE ( 'Table', 'Table'[Store-Number], 'Table'[Date (Year-Week)] ),
VAR CurrentWeek = 'Table'[Date (Year-Week)]
RETURN
COUNTROWS (
CALCULATETABLE (
VALUES ( 'Table'[Stock Value] ),
TOPN (
2,
FILTER (
ALL ( 'Table'[Date (Year-Week)] ),
'Table'[Date (Year-Week)] <= CurrentWeek
)
),
ALL ( 'Table' )
)
) = 2
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |