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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
deng2431
Helper I
Helper I

Filter the total count for the month then divide by each Category of that month

 

Hi PowerBI Community,

 

Being at this requirement for days but still couldnt figure it out, really hope someone can shine on light on this.

I have a Calculated column called 'Age Day Breakdown (Invoice Received Date)' which asign a breakdown based on how long it takes for an invoice to get paid (e.g. 20 days, 20 -30 days etc) and i also have Measure called [nvoice Count] which DISTINCTCOUNT the Invoice keys to ensure it is only counted once for duplicate keys.

 

The requirement is I need to calculate the total of [Invoice Count] for the month and then divide it each 'Age Day Breakdown (Invoice Received Date)' of that month so this allows me to keep the constant of the percentage for each breakdown when i expand the months on a slicer.  hope this makes sense, thank you in advance!!

 

deng2431_1-1669726075306.png

 

 

1 ACCEPTED SOLUTION
deng2431
Helper I
Helper I

Hey Guys, i realised what i asked for its not possible, i just ended up using 100% stacked column chart to solve this issue. thanks for taking the time to look into this. 

View solution in original post

9 REPLIES 9
deng2431
Helper I
Helper I

Hey Guys, i realised what i asked for its not possible, i just ended up using 100% stacked column chart to solve this issue. thanks for taking the time to look into this. 

deng2431
Helper I
Helper I

Hi @v-luwang-msft ,

 

thank you for your response, below is my sample data

 

Below is also the measure for the Invoice Count

Invoice Count = DISTINCTCOUNT('Fact PTRS Full Detail list'[Invoice Key])
 
Invoice AmountPayment Date (Final)Age Day Breakdown (Invoice Received Date)Invoice Key
$40,770.005/01/2022Within 20 Days300473631
$510,849.005/01/2022Within 20 Days300473632
$362,309.005/01/2022Within 20 Days300473633
$836,228.005/01/202231 - 60 Days300473630
$544,799.005/01/2022120 Days +300473665
$268,948.005/01/2022120 Days +300473666
$737,459.006/01/2022Within 20 Days300473324
$734,107.006/01/2022Within 20 Days300473325
$267,842.006/02/202221 - 30 Days300473361
$402,735.007/02/202221 - 30 Days300473362
$624,928.008/02/202221 - 30 Days300473363
$159,584.009/02/2022Within 20 Days300473629
$675,505.0010/02/2022Within 20 Days300473657
$461,756.0011/02/2022Within 20 Days300473658
$186,568.0012/02/2022Within 20 Days300473660
$125,670.0013/02/2022120 Days +300473664
$23,693.0014/02/2022120 Days +300473689
$647,173.0015/02/2022120 Days +300473691
$41,258.0016/02/2022120 Days +300473694
$121,739.0017/02/2022Within 20 Days300473696
$901,140.0018/02/2022Within 20 Days300473698
$696,555.0019/02/202221 - 30 Days300471445
$620,056.0020/02/202221 - 30 Days300471446
$17,169.0021/02/202221 - 30 Days300471648
$746,812.0022/02/202231 - 60 Days300472117
$892,503.0023/02/202232 - 60 Days300472122
$459,311.0024/02/202233 - 60 Days300472123
$868,184.006/03/202234 - 60 Days300472133
$5,346.007/03/202221 - 30 Days300472215
$623,323.008/03/202221 - 30 Days300472216
$249,457.009/03/202221 - 30 Days300472217
$441,168.0010/03/2022Within 20 Days300472251
$389,775.0011/03/2022Within 20 Days300472252
$128,900.0012/03/2022Within 20 Days300472253
$840,447.0013/03/2022Within 20 Days300472255
$841,255.0014/03/202221 - 30 Days300472256
$890,314.0015/03/2022120 Days +300472257
$934,827.0016/03/2022121 Days +300472258
$369,981.0017/03/2022122 Days +300472259

 

This is the expected result i am after

MonthLongCaptionInvoice AmountAge Day Breakdown (Invoice Received Date)Invoice CountTotal Month CountPercntage 
Jan-22$65,779,620.90Within 20 Days51050.00%
Jan-22$4,844,804.2521 - 30 Days11010.00%
Jan-22$4,947,326.5431 - 60 Days11010.00%
Jan-22$85,465.2761 - 90 Days11010.00%
Jan-22$42,779.7791 - 120 Days0100.00%
Jan-22$34,257,770.86120 Days +21020.00%
Feb-22$85,790,248.32Within 20 Days61931.58%
Feb-22$10,737,667.7121 - 30 Days61931.58%
Feb-22$4,938,695.9831 - 60 Days31915.79%
Feb-22$410,902.3961 - 90 Days0190.00%
Feb-22$64,335.8091 - 120 Days0190.00%
Feb-22$40,746,044.79120 Days +41921.05%
Mar-22$390,408,235.95Within 20 Days41136.36%
Mar-22$9,702,974.3021 - 30 Days41136.36%
Mar-22$3,340,285.5731 - 60 Days1119.09%
Mar-22$157,769.5061 - 90 Days0110.00%
Mar-22$41,716.3491 - 120 Days0110.00%
Mar-22$30,003,013.22120 Days +21118.18%

 

 

 I am using the Month Year column data from the Calendar table 

deng2431_0-1669847872294.png

 

A few comments and I apologize if I have misunderstood...

  • The Sample Data has a total of invoices equal to $18.7M whereas with the Expected Results the total is around $686M according to my calculations based on the source data.  Additionally, in your table shown, the total seems to be around $866M.  There has to be a way to reconcile/prove any results.
  • Why are there 2 fact tables in your model but your sample data only includes 1 table?
    • From the model view, it looks like there is a many-to-one relationship between ‘Fact PTRS Full Detail list’ and another table (‘Fact Invoice Register Transactions’?) except I’m not exactly sure how they are related.
  • How are you calculating your calculated column [Age Breakdown (Invoice Received Date)]?
    • Why are there different categories that are open-ended?
      • “120 Days +”, “121 Days +”, “122 Days +”
    • (It would probably be better to make a new dimension table with all categories which has a sort column and try to incorporate that.)

pbix:    https://1drv.ms/u/s!AnF6rI36HAVkhPIB0y10OMKvPEVItw?e=yk4dhT

 

Let me know if you need any clarification.

Hi @grantsamborn,

 

Thank you for taking the time regarding this and apologies that i have made this confusing. 

 

  • the same data value doesnt really matter for the result, what i really care about is the distinct count [Invoice count] of the Invoice key column. the dollar amount didnt match up as i just did it with random number for the amount.
  • Yes, i got 2 Fact tables but i am primarily using one 'Fact PTRS Full detail list', i use this fact table to use as a drill through into another fact table via the invoice numbers, as the 2 fact table shows different details for the same invoice number. but this setup shouldnt affect what this is trying to do.
  • The calculated column [Age Breakdown (Invoice Received Date)] is using the below measure: 
    • Age Day Breakdown (Invoice Received Date) =
      Switch(true(),
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) > 120, "120 Days +",
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) >= 91, "91 - 120 Days",
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) >= 61, "61 - 90 Days",
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) >= 31, "31 - 60 Days",
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) >= 21, "21 - 30 Days",
           'Fact PTRS Full Detail list'[Payment Date (Final)] = BLANK(), "Unpaid in Full",
          ('Fact PTRS Full Detail list'[Payment Date (Final)] - 'Fact PTRS Full Detail list'[Invoice Received Date]) <= 20, "Within 20 Days )
       
       
       
       
       
      • regarding the different age down, “120 Days +”, “121 Days +”, “122 Days +”. that's my fat fingers when i enter it manually, it should be just “120 Days +" and not the rest.
      • thats a good idea with creating a dimension table for my categories, at the moment my table is pretty small, just over 120,000 rows. 
       
       

Regarding the first point:  My results for the Total Month Count for the 3 months differ from yours.

 MineYours
Jan810
Feb1919
Mar1211

 

Is there any way you could come up with a pbix including both fact tables and your calculated columns and measures?  Also, expected results since the sample data will probably be different.

Fake data is fine if it can be used to demonstrate examples.  

 

My pbix: https://1drv.ms/u/s!AnF6rI36HAVkhPICoiZSqhiW2DeHLw?e=8usZw5

 

 

Hi @grantsamborn,

 

Really appreciate you taking the time to help me out with this. thank you!

 

I have attached the pbix file with the fact table (i am only utilising one) with the calculated columns and measures. and also the expected result in an excel file. 

 

PBIX file - https://drive.google.com/drive/folders/1jCPpYhIfVp6vAcYyYB8NFUiD5Q7iYPl6?usp=share_link

 

thank you for your help in advance.

Hi @deng2431 

For personal/health reasons, I am going to have to refer you to many others on this board including

@v-luwang-msft 

 

@amitchandak 

 

@Greg_Deckler 

I hope you find a solution.

Hi @grantsamborn , thank you for looking into this for me, appreciate it!

Hope you have a speedy recovery and all the best!!

v-luwang-msft
Community Support
Community Support

Hi @deng2431 ,

Please share sample data and expected data results, remembering to delete confidential data.

 

 

Best Regards

Lucien

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors