Forum Discussion
gauravnarchal
6 years agoPost Prodigy
Calculate Due date / Statement Date
Hello All I need your help in creating a measure from the below table. Requirment If statement group is "M" result = EOMONTH + 1 + credit days Example If statement group is "M" & Credit d...
- 6 years ago
Hi gauravnarchal ,
Create a measure as below:
Measure = SWITCH ( MAX ( 'Table'[statement group] ), "M", EOMONTH ( MAX ( 'Table'[invoice date] ), 0 ) + 1 + MAX ( 'Table'[credit days] ), "F", IF ( DAY ( MAX ( 'Table'[invoice date] ) ) <= 15, DATE ( YEAR ( MAX ( 'Table'[invoice date] ) ), MONTH ( MAX ( 'Table'[invoice date] ) ), 15 ) + 1 + MAX ( 'Table'[credit days] ), EOMONTH ( MAX ( 'Table'[invoice date] ), 0 ) + 1 + MAX ( 'Table'[credit days] ) ) )And you will see:
For the related .pbix file ,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
gauravnarchal
6 years agoPost Prodigy
lkalawski - I have to use measure instead of calculated column. Can you please help!
lkalawski
6 years agoResident Rockstar
Please use it:
Conditional_2 =
VAR _invoicedate = SELECTEDVALUE(Tabele[invoice date])
VAR _statementgroup = SELECTEDVALUE(Tabele[statement group]) -- You need adjust this variable. If statementgroup is not a static column then remove selectedvalue
VAR _creditdays = SELECTEDVALUE(Tabele[credit days]) -- You need adjust this variable. If creditdays is not a static column then remove selectedvalue
RETURN
SWITCH(_statementgroup,
"M", EOMONTH(_invoicedate,0) + 1 + _creditdays,
"F", SWITCH(TRUE(),
DAY(_invoicedate) <= 15, DATE(YEAR(_invoicedate), MONTH(_invoicedate),15) + 1 + _creditdays,
EOMONTH(_invoicedate,0) + 1 + _creditdays
))
_______________
If I helped, please accept the solution and give kudos! 😀