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
Objective:- Dynamic calculations basis Date selection
Requirement :- Categorise all transactions basis difference between selected date and Due Date of Transaction into different buckets as below
- 31-60 : if date difference between selected date and Due Date is >30, categorise it as "31-60"
- 1-30 : if date difference between selected date and Due Date is between 1-30, categorise it as "1-30"
- Current : if date difference between selected date and Due Date is <= 0, categorise it as "Current"
Create a 100% stacked bar, showing bucket-wise Net Amount
Scenario :- Date selected - 31/01/19
Refer this data
Solved! Go to Solution.
Hi, @Anonymous
It’s my pleasure to answer for you.
According to your description, I think you can create a calendar table to filter date, then create three similar measures,put them in 100% stacked bar chart.
Like this:
1-30 =
SUMX (
FILTER (
ADDCOLUMNS (
'Table',
"age",
VAR selecteddate =
SELECTEDVALUE ( 'Table 2'[Date] )
VAR duedate =
IF ( [Due Date] = BLANK (), TODAY (), [Due Date] )
RETURN
SWITCH (
TRUE (),
duedate - selecteddate > 30, "31-60",
duedate - selecteddate >= 0
&& duedate - selecteddate < 30, "1-30",
duedate - selecteddate < 0, "Current",
BLANK ()
)
),
[age] = "1-30"
),
[Net Amount]
)Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , where is Due Date ?
You can have a measure like this keep the smaller date before
Days = datediff(Selectedvalue(Date[Date]), max(Table[Due Date]), day)
Need a context to sum or Avg
Sumx(values(Table[Customter]),[Days])
For bucket refer my video on dynamic segmentation : https://www.youtube.com/watch?v=CuczXPj0N-k
Sorry my bad, mentioned the wrong dataset
Hi, @Anonymous
It’s my pleasure to answer for you.
According to your description, I think you can create a calendar table to filter date, then create three similar measures,put them in 100% stacked bar chart.
Like this:
1-30 =
SUMX (
FILTER (
ADDCOLUMNS (
'Table',
"age",
VAR selecteddate =
SELECTEDVALUE ( 'Table 2'[Date] )
VAR duedate =
IF ( [Due Date] = BLANK (), TODAY (), [Due Date] )
RETURN
SWITCH (
TRUE (),
duedate - selecteddate > 30, "31-60",
duedate - selecteddate >= 0
&& duedate - selecteddate < 30, "1-30",
duedate - selecteddate < 0, "Current",
BLANK ()
)
),
[age] = "1-30"
),
[Net Amount]
)Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
In a new column add the following formula to create the groups.
Then on the chart add the column and the net amount
Column =
var _selecteddate = SELECTEDVALUE('Calendar'[Date])
return
SWITCH (
TRUE (),
'Table'[Due_date] - _selecteddate > 30, "31-60",
'Table'[Due_date] - _selecteddate >= 0 && 'Table'[Due_date] - _selecteddate < 30 , "0-30",
'Table'[Due_date] - _selecteddate < 0, "Current",
BLANK()
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |