Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hi,
I am looking to use a measure (number of months) as a y axis but am unable to do so
context example:
I have a few book loan records that are already due to be returned. I want to track on a monthly basis, how many months it has been overdue and display it in a bar chart where number of months it is overdue is the Y axis and number of book loan IDs is the x axis. The number of months it is overdue will change over time depending on the value of today()
Using the example table below
Book Loan ID, due date
Book Loan A, 01 Jan 25
Book Loan B, 01 Feb 25
Book Loan C, 01 Mar 25
Book loan D, 01 Jan 25
The graph should look something like this and the y axis shld change according to the number of months the loans has been overdue
How should i go about doing this?
Could you please confirm if your query have been resolved the solution provided by @danextian and @DataNinja777 ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.
Thank you
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,
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
76 | |
75 | |
70 | |
47 | |
41 |
User | Count |
---|---|
64 | |
41 | |
31 | |
30 | |
28 |