Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello Guys,
the following challenge:
For our inventory tracking, we build groups:
green = < 30 days
yellow = 30 - 90 days
red = > 90 days
In Power Bi we realized that with the SWITCH statement
Group by Age =
SWITCH(
True(),
fact_stock[age in days]>=90,"3. >=90 days",
fact_stock[age in days]>=30,"2. 30 - 90 days",
fact_stock[age in days]>=0,"1. <= 30 days" )
-> this statement work fine. the age in days is in database.
-> the fact_table is a weekly export with the following structure:
-> the unique ID is an Stock unit ID
date | stock unit id | value | age in days | group by age |
05.03.2023 | 12345679 | 100 | 23 | < 30 days |
05.03.2023 | 12345678 | 250 | 90 | > 90 days |
05.03.2023 | 12345677 | 100 | 89 | 30 - 90 days |
05.03.2023 | 12345676 | 50 | 33 | 30 - 90 days |
12.03.2023 | 12345679 | 50 | 30 | 30 - 90 days |
12.03.2023 | 12345678 | 50 | 97 | > 90 days |
12.03.2023 | 12345677 | null | null | consumed |
12.03.2023 | 12345676 | 25 | 40 | 30 - 90 days |
12.03.2023 | 12345684 | 75 | 2 | < 30 days |
Following questions i have to answer every monday:
- which stock units are new in comparison to previuos week
- which stock units are consumpted in comparison to previus week?
- which stock units changed the age bucket?
- for example: stock unit 12345678 changed from 30 - 90 days into bucket > 90 days
How should i build this in power bi?
Hi,
The last question is the most interesting one so i will take that up later. For the first 2 questions, could you kinldy share the following:
To report on things that aren't there you need to use disconnected tables and crossjoins.
Status =
SWITCH(TRUE(),
min(Weeks[date])=CALCULATE(min(Weeks[date]),all(Weeks[date])),BLANK(),
not isblank([val]) && isblank(calculate([Val],DATEADD(Weeks[date],-7,DAY))),"new this week",
isblank([val]) && not isblank(calculate([Val],DATEADD(Weeks[date],-7,DAY))),"consumed",
[Bucket]<>(calculate([Bucket],DATEADD(Weeks[date],-7,DAY))),"bucket change")
see attached
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 60 | |
| 49 | |
| 30 | |
| 25 | |
| 23 |
| User | Count |
|---|---|
| 130 | |
| 103 | |
| 58 | |
| 39 | |
| 31 |