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! Get ahead of the game and start preparing now! Learn more
Hi,
I have a calendar table as described below:
I would like to create groups on it like :
if calendar[date] = today then "0 day"
else if calendar[date] between today+1 and today+10 then "1-10 days"
else if calendar[date] between today+11 and today+20 then "11-20 days"
else if calendar[date] between today+21 and today+30 then "21-30 days"
and so on..
I am trying to use the switch over here but it is not working:
Column =
var x = today()
var y = DATESBETWEEN('Calendar'[new_date],x,x+11)
var z = DATESBETWEEN('Calendar'[new_date],y,y+11)
return SWITCH('Calendar'[new_date]=X,"0 DAY",'Calendar'[new_date]=y ,"1-10 days"))
Could you please help me in achieving this?
Solved! Go to Solution.
Try this:
Column =
VAR diff = Calendar[Date] - TODAY()
RETURN
SWITCH(TRUE(),
diff < 0, BLANK(),
diff = 0, "0 days",
diff <= 10, "1-10 days",
diff <= 20, "11-20 days",
diff <= 30, "21-30 days",
"> 30 days"
)
Try this:
Column =
VAR diff = Calendar[Date] - TODAY()
RETURN
SWITCH(TRUE(),
diff < 0, BLANK(),
diff = 0, "0 days",
diff <= 10, "1-10 days",
diff <= 20, "11-20 days",
diff <= 30, "21-30 days",
"> 30 days"
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 36 | |
| 34 | |
| 31 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 103 | |
| 66 | |
| 65 | |
| 56 |