Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. 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?
Solved! Go to Solution.
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
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
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,
User | Count |
---|---|
84 | |
73 | |
73 | |
56 | |
51 |
User | Count |
---|---|
43 | |
41 | |
36 | |
34 | |
30 |