Forum Discussion
common763
Helper III
2 years agoMultiple Date Calculations in Slicer from Row data
I have a dataset that has multiple different date calculations on the same row. Date1,2,3,etc. There are 12 separate date differential calculations between about 6-8 different date columns on the ...
- 2 years ago
Here is a DAX version of ahadkarimi 's answer. (The power query version is way easier for larger datasets.)
categoryTable = var _t1 = SELECTCOLUMNS( surveyTable, "_survey", [Survey], "_category", "cat1", "_value", DATEDIFF([Date1], [Date2], DAY) ) var _t2 = SELECTCOLUMNS( surveyTable, "_survey", [Survey], "_category2", "cat2", "_value", DATEDIFF([Date1], [Date3], DAY) ) var _t3 = SELECTCOLUMNS( surveyTable, "_survey", [Survey], "_category3", "cat3", "_value", DATEDIFF([Date2], [Date4], DAY) ) Return UNION(_t1, _t2, _t3)
jgeddes
Super User
2 years agoHere is a DAX version of ahadkarimi 's answer. (The power query version is way easier for larger datasets.)
categoryTable =
var _t1 =
SELECTCOLUMNS(
surveyTable,
"_survey", [Survey],
"_category", "cat1",
"_value", DATEDIFF([Date1], [Date2], DAY)
)
var _t2 =
SELECTCOLUMNS(
surveyTable,
"_survey", [Survey],
"_category2", "cat2",
"_value", DATEDIFF([Date1], [Date3], DAY)
)
var _t3 =
SELECTCOLUMNS(
surveyTable,
"_survey", [Survey],
"_category3", "cat3",
"_value", DATEDIFF([Date2], [Date4], DAY)
)
Return
UNION(_t1, _t2, _t3)