Forum Discussion
using a measure as a y axis
- 1 year ago
hI hamburgernic
If you're going to compare the due date with the current date, a simple DATEDIFF calculated column against today's date should be enough
Months Due = DATEDIFF ( 'Table'[Due Date], TODAY(), MONTH )However, if you want to determine how many months a book loan is due based on a date selected in a slicer — and expect the numbers in the visual to change accordingly — this approach will not work. Calculated columns are not responsive to slicer selections and will not adjust their values dynamically. That said, based on your description, the calculated column provided above should still meet your needs.
Hi hamburgernic ,
If you're seeing just the number of days overdue and not a count of how many loans fall into each overdue bucket, that likely means you're using a measure or raw column directly in the visual, instead of grouping it properly.
First, confirm you're using this as a calculated column, not a measure:
Months Overdue = DATEDIFF('Loans'[Due Date], TODAY(), MONTH)
This column should return whole numbers like 1, 2, 3 for each loan.
Now, create a bar chart.
Drag Months Overdue to the Y-axis (this becomes your group, not a value), and then drag Book Loan ID to the X-axis using Count aggregation (or just drag Book Loan ID again and let Power BI auto-aggregate). This will show you how many book loans fall into each “months overdue” bucket.
If you want to group by months and show total value (e.g., amount per loan), then use this setup:
Make sure your table has a column like Loan Amount, then use a bar chart with:
Y-axis: Months Overdue
X-axis: a measure like:
Total Loan Amount = SUM('Loans'[Loan Amount])
This gives you total overdue loan amount by number of months overdue. If you’re still only seeing day-level data, make sure you’re not accidentally using DATEDIFF(..., DAY) instead of MONTH.
Do you want to show the loan amounts overdue by month, or the count of books overdue by month?
Best regards,