Forum Discussion
bog12345
8 years agoFrequent Visitor
changed or not compared to the previous date
Hi, I need help with Dax. There are 4 column in my test table as follows: -ID: every customer have unique ID, every row means one subscription -start of service: The start of the subscription...
- 8 years ago
Hi bog12345,
You could create the calculated column with the formula below.
Chaging =
VAR previous_date =
CALCULATE (
MAX ( 'Table'[Start of service] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[ID] ),
'Table'[Start of service] < EARLIER ( 'Table'[Start of service] )
)
)
VAR previous_Number =
LOOKUPVALUE (
'Table'[Number of Service],
'Table'[ID], 'Table'[ID],
'Table'[Start of service], previous_date
)
RETURN
IF (
previous_Number = BLANK ()&&'Table'[ID]='Table'[ID],
0,
IF ( previous_Number = 'Table'[Number of Service]&&'Table'[ID]='Table'[ID], 0, 1 )
)Then you will get the output you expected.
Hope it can help you!:smileytongue:
Best regards,
Cherry
v-piga-msft
Resident Rockstar
8 years agoHi bog12345,
You could create the calculated column with the formula below.
Chaging =
VAR previous_date =
CALCULATE (
MAX ( 'Table'[Start of service] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[ID] ),
'Table'[Start of service] < EARLIER ( 'Table'[Start of service] )
)
)
VAR previous_Number =
LOOKUPVALUE (
'Table'[Number of Service],
'Table'[ID], 'Table'[ID],
'Table'[Start of service], previous_date
)
RETURN
IF (
previous_Number = BLANK ()&&'Table'[ID]='Table'[ID],
0,
IF ( previous_Number = 'Table'[Number of Service]&&'Table'[ID]='Table'[ID], 0, 1 )
)
Then you will get the output you expected.
Hope it can help you!:smileytongue:
Best regards,
Cherry
bog12345
8 years agoFrequent Visitor
Thanks, it works :)