Forum Discussion
Grouping and Dates Formula
- 8 years ago
Hi Anonymous,
I modify the old formula. Please try it again.
Result = VAR minChangeDate = CALCULATE ( MIN ( 'Table'[Date of Change] ), ALL ( 'Table' ) ) VAR maxChangeDate = CALCULATE ( MAX ( 'Table'[Date of Change] ), ALL ( 'Table' ) ) RETURN DATEDIFF ( CALCULATE ( MIN ( 'table'[Old Value Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Date of Change] = minChangeDate ) ), CALCULATE ( MAX ( 'table'[New Del Value Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Date of Change] = maxChangeDate ) ), DAY )About grouping:
grouping = SUMX ( SUMMARIZE ( 'Table', 'Table'[Sales Order], [Old Value Date], [New Del Value Date], [Date of Change], "Value", [Result] ), [Value] )Best Regards,
Dale
Hi Anonymous,
I modify the old formula. Please try it again.
Result =
VAR minChangeDate =
CALCULATE ( MIN ( 'Table'[Date of Change] ), ALL ( 'Table' ) )
VAR maxChangeDate =
CALCULATE ( MAX ( 'Table'[Date of Change] ), ALL ( 'Table' ) )
RETURN
DATEDIFF (
CALCULATE (
MIN ( 'table'[Old Value Date] ),
FILTER ( ALL ( 'Table' ), 'Table'[Date of Change] = minChangeDate )
),
CALCULATE (
MAX ( 'table'[New Del Value Date] ),
FILTER ( ALL ( 'Table' ), 'Table'[Date of Change] = maxChangeDate )
),
DAY
)
About grouping:
grouping =
SUMX (
SUMMARIZE (
'Table',
'Table'[Sales Order],
[Old Value Date],
[New Del Value Date],
[Date of Change],
"Value", [Result]
),
[Value]
)
Best Regards,
Dale
Thank you for helping out. However, I still don't get the result. Not too sure why when all script are correct, but when i input the formula I don't get 92 days instead error of 243 days.
As for the grouping, that is not the outcome I needed.
I have move on with an alternative visual and analyzing method.
Thank you once again.
- v-jiascu-msft8 years agoMicrosoft Employee
Can you share your file?
Best Regards,
Dale
- Anonymous8 years agoNot applicable
- v-jiascu-msft8 years agoMicrosoft Employee
Hi Anonymous,
Did it work? Can you mark the proper answer as a solution?
Best Regards,
Dale
- Anonymous8 years agoNot applicable
Yes it works. However, for grouping that's not what I want.
For grouping I am expecting the visual in a table form meaning table with darken borders for the same group of sales order, not grouping as a summary by measure.