Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BIlal3
Regular Visitor

Create the customer aging report the aging calculation base on the user selected date by the slicer

Hello,

I'm working on a customer aging report in Power BI where the aging calculations are based on a user-selected date from a slicer. The table visualization displays the correct calculations, but the matrix visualization is showing incorrect results. I've been troubleshooting this issue for the past five days without success.

Could you please help me resolve this? For clarity, I've attached the PBIX file.

 

BIlal3_1-1723924772265.png

 

 

 

1 ACCEPTED SOLUTION

Hi @BIlal3 

 

I created a Buckets table like this:

gmsamborn_0-1723966825091.png

 

Then a single measure:

 

Bucket Amt = 
VAR _AgingDate = MAX( 'Date'[Date] )
VAR _Lower = SELECTEDVALUE( 'Buckets'[lower] )
VAR _Upper = SELECTEDVALUE( 'Buckets'[Upper] )
VAR _Table1 =
    FILTER(
        ADDCOLUMNS(
            'OINV',
            "__Days",
                INT( _AgingDate - [docdate] )
        ),
        [__Days] >= _Lower
            && [__Days] <= _Upper
    )
VAR _Result = 
    SUMX(
        _Table1,
        [doctotal]
    )
RETURN
    _Result

 

 

Let me know if you have any questions.

 

Dynamic Aging.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1724076687707.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
BIlal3
Regular Visitor

hello @BIlal3 

 

i dont see any problem with either table or matrix.

C789 only have "101-200 Days" value in 'Bucket_CAL' with Sum of doctoral is 1260.

Both matrix and table show exact same value.

Irwan_0-1723943224567.png

 

i might be misunderstood your issue but looks like to me that you want to have the matrix column value (matrix header) changed depend on the date slicer therefor you compare your 'Bucket_CAL' in matrix visual with your 'Bucket' in table visual.

 

'Bucket' as measure will have vary of values depend on your date slicer while 'Bucket_CAL' as column will have single value (this means that your matrix column will stay same regardless where date slicer is placed).

 

Hope this will help.

Thank you.

Thank you for the reply. I’m new to Power BI, and this is my first post, so I may not have explained my issue clearly.

I need to create a bar chart with the following setup:

  • X-axis: Buckets such as 0-30 days, 31-60 days, 61-90 days, etc.
  • Y-axis: The sum of DocTotal, based on the date selected by the slicer.

For example, if I select the date 01-08-2024 in the slicer, the measure should display the correct values, which I have already verified with the SAP Business One application.

Problem 1:

  • I am unable to drop the Bucket measure into the X-axis. Power BI does not allow me to do.

BIlal3_3-1723952919565.png

 

Problem 2:

  • As a workaround, I created a calculated column called Bucket_cal, which Power BI does allow me to drop into the X-axis, but the calculations are incorrect. Here’s the DAX formula I used: Days_cal = DATEDIFF(SELECTEDVALUE(OINV[docdate]), DateTable[datecalmax], DAY)
    how DAX formula is work’s invoice date, max date of my datetable           

Example:

Doc. No.

Posting Date

DateTable[datecalmax]

Amount

0 - 30

31 - 60

61 - 90

100 - 200

1317

17.08.24

31.12.24

GBP  240.00

   

GBP  240.00

1318

17.07.24

31.12.24

GBP  120.00

   

GBP  120.00

1319

06.08.24

31.12.24

GBP  180.00

   

GBP  180.00

1320

13.07.24

31.12.24

GBP  300.00

   

GBP  300.00

1321

18.06.24

31.12.24

GBP  240.00

   

GBP  240.00

1322

03.07.24

31.12.24

GBP  180.00

   

GBP  180.00

I also have the actual calculations from the SAP application based on two dates:

  1. 01-08-2024

BIlal3_4-1723952919570.png

2- 17-08-2024

BIlal3_0-1723954264793.png

 

 

I hope this helps clarify my problem. If you need more information, please let me know, and thanks again!

 

Hi @BIlal3 

 

I created a Buckets table like this:

gmsamborn_0-1723966825091.png

 

Then a single measure:

 

Bucket Amt = 
VAR _AgingDate = MAX( 'Date'[Date] )
VAR _Lower = SELECTEDVALUE( 'Buckets'[lower] )
VAR _Upper = SELECTEDVALUE( 'Buckets'[Upper] )
VAR _Table1 =
    FILTER(
        ADDCOLUMNS(
            'OINV',
            "__Days",
                INT( _AgingDate - [docdate] )
        ),
        [__Days] >= _Lower
            && [__Days] <= _Upper
    )
VAR _Result = 
    SUMX(
        _Table1,
        [doctotal]
    )
RETURN
    _Result

 

 

Let me know if you have any questions.

 

Dynamic Aging.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
BernatAgulloMVP
Most Valuable Professional
Most Valuable Professional

This looks good to me

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors