cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Measure for overdue invoices report

Hello,

Newbie here. I need to calculate the number of invoices which were overdue on the last day of the month for the last 12 months. The criteria for an invoice to be considered overdue is: 

Parked Date < X < Clearing Date , and X > Net Due Date (where X is the last day of a given month)

 

Here below is a sample of my 2 tables. I have a main relationship between Calendar[Date] and Overdues_DB[ParkedDate], and secondary relationships between Calendar[Date] and Overdues_DB[ClearingDate] and Overdues_DB[NetDueDate].

 

Calendar   

DateMonth-Year
29.07.201919-Jul
30.07.201919-Jul
31.07.201919-Jul
01.08.201919-Aug
02.08.201919-Aug
03.08.201919-Aug

 

Overdues_DB

Invoice IDParkedDateNetDueDateClearingDate
200009-65-201911.07.201923.07.201908.08.2019
200010-65-201911.07.201922.07.201925.07.2019
200011-65-201912.07.201928.06.201907.08.2019
200014-65-201925.07.201907.08.201915.08.2019
200016-65-201929.07.201901.07.201929.07.2019

 

Here is my attempt but since the main relationship is with ParkedDate, only the first IF is working. I tried adding USERELATIONSHIP into the formula but I get error messages and I dont really know if this is even possible.

 

VAR Lastday = MAX('Calendar'[Date])
 

OverdueInvoices_Count = CALCULATE( DISTINCTCOUNT( Overdues_DB[InvoiceID]),
                                                           FILTER(Overdues_DB, Overdues_DB [ParkedDate] < [VAR Lastday] &&
                                                           [VAR Lastday] < Overdues_DB[ClearingDate] &&
                                                           [VAR Lastday] < Overdues_DB[NetDueDate] ))

 

Could you please help me to set up a measure that evaluates all 3 dates involved? Or any other way to do this.

 

Any light is greatly appreciated.

Desiree                                                                     

     

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous - OK, took a closer look, I am thinking:

 

Measure = 
  VAR __Table =
    ADDCOLUMNS(
      GENERATE(
        'Overdues_DB',
        Calendar
      ),
      "Overdue",IF([Date]<[ParkedDate] && [Date]>[ClearingDate]&&[Date]>[NetDueDate]),1,0
    )
RETURN
  COUNTROWS(FILTER(__Table,[Overdue]=1))
  

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Anonymous - OK, took a closer look, I am thinking:

 

Measure = 
  VAR __Table =
    ADDCOLUMNS(
      GENERATE(
        'Overdues_DB',
        Calendar
      ),
      "Overdue",IF([Date]<[ParkedDate] && [Date]>[ClearingDate]&&[Date]>[NetDueDate]),1,0
    )
RETURN
  COUNTROWS(FILTER(__Table,[Overdue]=1))
  

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

This worked! Thank you so much!

 

 

Greg_Deckler
Super User
Super User

@Anonymous - You can use EOMONTH([Date],0) to get the last day of a month. Will have to look a little closer beyond that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors