Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Dear All
I need your help to create few measure as below. Can you please help?
I have attached the data for your reference. Thank You for your help in advance.
1) If Invoice date & cash receipt date is less than or equal to selected date
AND
Invoice Amount if fully Paid
Result
Paid Invoices
2) If Invoice is not paid or partially paid as of selected date
Result
Sum of Total Outstanding Invoices as of selected date (*For partially paid Invoices only balance should be calculated as of selected date)
3) Total Invoice Amount On or Before as of Selected Date
4) Total Invoice Amount After as of Selected Date
5) Unpaid Invoices as of Selected Date (Outstanding)
Solved! Go to Solution.
Hi @gauravnarchal ,
Please refer to the measure below:
Paid Invoices or Outstanding Invoices 2 =
VAR SelectedDate =
MAX ( 'Calendar'[Date] )
VAR ReceiptDate =
CALCULATE (
MAX ( Cash_receipt[Receipt_Date] ),
FILTER (
Cash_receipt,
Cash_receipt[invoice_id] = MAX ( ARInvoices[invoice_id] )
)
)
RETURN
IF (
HASONEVALUE ( ARInvoices[invoice_id] ),
IF (
MAX ( ARInvoices[invoice_date] ) <= SelectedDate
&& ReceiptDate <= SelectedDate
&& NOT ( ISBLANK ( ReceiptDate ) ),
BLANK (),
CALCULATE (
SUM ( ARInvoices[InvoiceAmount] ),
FILTER (
ARInvoices,
ARInvoices[invoice_date] <= SelectedDate
&& ARInvoices[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
- CALCULATE (
SUM ( Cash_receipt[ReceiptAmount] ),
FILTER (
Cash_receipt,
Cash_receipt[Receipt_Date] <= SelectedDate
&& Cash_receipt[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
),
[Unpaid Invoices as of Selected Date (Outstanding)]
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hello @gauravnarchal ,
Please refer to the following measurement for your for 1) and 2):
Paid Invoices or Outstanding Invoices =
VAR SelectedDate =
MAX ( 'Calendar'[Date] )
VAR ReceiptDate =
CALCULATE (
MAX ( Cash_receipt[Receipt_Date] ),
FILTER (
Cash_receipt,
Cash_receipt[invoice_id] = MAX ( ARInvoices[invoice_id] )
)
)
RETURN
IF (
MAX ( ARInvoices[invoice_date] ) <= SelectedDate
&& ReceiptDate <= SelectedDate
&& NOT ( ISBLANK ( ReceiptDate ) ),
"Paid Invoices",
CALCULATE (
SUM ( ARInvoices[InvoiceAmount] ),
FILTER (
ARInvoices,
ARInvoices[invoice_date] <= SelectedDate
&& ARInvoices[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
- CALCULATE (
SUM ( Cash_receipt[ReceiptAmount] ),
FILTER (
Cash_receipt,
Cash_receipt[Receipt_Date] <= SelectedDate
&& Cash_receipt[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
)
And the following measures for 3,4)y5):
Total Invoice Amount On or Before as of Selected Date = VAR SelectedDate = MAX('Calendar'[Date]) Return CALCULATE(SUM(ARInvoices[InvoiceAmount]),FILTER(ALL(ARInvoices),ARInvoices[invoice_date]<=SelectedDate))
Total Invoice Amount After as of Selected Date = VAR SelectedDate = MAX('Calendar'[Date]) Return CALCULATE(SUM(ARInvoices[InvoiceAmount]),FILTER(ALL(ARInvoices),ARInvoices[invoice_date]>=SelectedDate))
Unpaid Invoices as of Selected Date (Outstanding) = VAR SelectedDate = MAX('Calendar'[Date]) return CALCULATE(SUM(ARInvoices[InvoiceAmount]),FILTER(ARInvoices,ARInvoices[invoice_date]<= SelectedDate&&ARInvoices[invoice_id] IN DISTINCT(ARInvoices[invoice_id])))-CALCULATE(SUM(Cash_receipt[ReceiptAmount]),FILTER(Cash_receipt,Cash_receipt[Receipt_Date]<=SelectedDate&&Cash_receipt[invoice_id] IN DISTINCT(ARInvoices[invoice_id])))
For more information, see the pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EcdVIyl6dB9HgV98-G...
If this post helps, then consider Accept it as the solution to help other members find it faster.
Best regards
Dedmon Dai
How can I filter/remove Paid Invoices from the "Paid Invoices or Outstanding Invoices measure"? The table should only show outstanding Invoices.
Thank you for all your help.
Hi @gauravnarchal ,
Just change the measure to show blank:
Paid Invoices or Outstanding Invoices =
VAR SelectedDate =
MAX ( 'Calendar'[Date] )
VAR ReceiptDate =
CALCULATE (
MAX ( Cash_receipt[Receipt_Date] ),
FILTER (
Cash_receipt,
Cash_receipt[invoice_id] = MAX ( ARInvoices[invoice_id] )
)
)
RETURN
IF (
MAX ( ARInvoices[invoice_date] ) <= SelectedDate
&& ReceiptDate <= SelectedDate
&& NOT ( ISBLANK ( ReceiptDate ) ),
Blank(),
CALCULATE (
SUM ( ARInvoices[InvoiceAmount] ),
FILTER (
ARInvoices,
ARInvoices[invoice_date] <= SelectedDate
&& ARInvoices[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
- CALCULATE (
SUM ( Cash_receipt[ReceiptAmount] ),
FILTER (
Cash_receipt,
Cash_receipt[Receipt_Date] <= SelectedDate
&& Cash_receipt[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hello @v-deddai1-msft
I have changed the measure as advised. Now i don't see the total when I select any the date after 12th June.
I have attached the PBIX.
Thank you for the help in advance.
Gaurav
Hi @gauravnarchal ,
Please refer to the measure below:
Paid Invoices or Outstanding Invoices 2 =
VAR SelectedDate =
MAX ( 'Calendar'[Date] )
VAR ReceiptDate =
CALCULATE (
MAX ( Cash_receipt[Receipt_Date] ),
FILTER (
Cash_receipt,
Cash_receipt[invoice_id] = MAX ( ARInvoices[invoice_id] )
)
)
RETURN
IF (
HASONEVALUE ( ARInvoices[invoice_id] ),
IF (
MAX ( ARInvoices[invoice_date] ) <= SelectedDate
&& ReceiptDate <= SelectedDate
&& NOT ( ISBLANK ( ReceiptDate ) ),
BLANK (),
CALCULATE (
SUM ( ARInvoices[InvoiceAmount] ),
FILTER (
ARInvoices,
ARInvoices[invoice_date] <= SelectedDate
&& ARInvoices[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
- CALCULATE (
SUM ( Cash_receipt[ReceiptAmount] ),
FILTER (
Cash_receipt,
Cash_receipt[Receipt_Date] <= SelectedDate
&& Cash_receipt[invoice_id] IN DISTINCT ( ARInvoices[invoice_id] )
)
)
),
[Unpaid Invoices as of Selected Date (Outstanding)]
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
User | Count |
---|---|
122 | |
109 | |
97 | |
60 | |
57 |
User | Count |
---|---|
137 | |
114 | |
102 | |
70 | |
56 |