Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All
I need to calculate the difference between the date of receipt of the invoice and the date of payment.
Challenge: The two dates are in one column,
- to get the date of receipt of the invoice I need to apply this condition :
BEWTP=E and BWART=101 and WERKS=1000
- to get the date of payment I need to apply this condition
BEWTP=Q and SHKZG=S and WERKS=1000
Your answer is appreciated
Solved! Go to Solution.
Hi @Shak_95 ,
Suppose there is a table like this(There should be an invoice id column):
Then new a calculated column:
days =
VAR _mindate =
CALCULATE (
MIN ( 'Table'[CPUDT_DATE] ),
FILTER (
'Table',
'Table'[BEWTP] = "E"
&& 'Table'[BWART] = 101
&& 'Table'[WERKS] = 1000
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
VAR _maxdate =
CALCULATE (
MAX ( 'Table'[CPUDT_DATE] ),
FILTER (
'Table',
'Table'[BEWTP] = "Q"
&& 'Table'[SHKZG] = "S"
&& 'Table'[WERKS] = 1000
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
VAR _difference =
DATEDIFF ( _mindate, _maxdate, DAY )
RETURN
_difference
The PBIX file is attached for reference.
Best Regards,
changqing
Hi @Shak_95 ,
Suppose there is a table like this(There should be an invoice id column):
Then new a calculated column:
days =
VAR _mindate =
CALCULATE (
MIN ( 'Table'[CPUDT_DATE] ),
FILTER (
'Table',
'Table'[BEWTP] = "E"
&& 'Table'[BWART] = 101
&& 'Table'[WERKS] = 1000
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
VAR _maxdate =
CALCULATE (
MAX ( 'Table'[CPUDT_DATE] ),
FILTER (
'Table',
'Table'[BEWTP] = "Q"
&& 'Table'[SHKZG] = "S"
&& 'Table'[WERKS] = 1000
&& 'Table'[ID] = EARLIER ( 'Table'[ID] )
)
)
VAR _difference =
DATEDIFF ( _mindate, _maxdate, DAY )
RETURN
_difference
The PBIX file is attached for reference.
Best Regards,
changqing
Thank you very much changqing for your help, i appreciate it
UP
kindly help
I think that you can try to use SUMMARIZE and after that use ADDCOLUMNS with MAX(Date) - MIN(Date)
thank you for your reply
Kindly, can you share the expression and steps that achieves what i want.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |