Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hola
Quiero ver el precio y las reseñas de los artículos en función de la fecha seleccionada.
Cuando uso solo una segmentación de datos, los valores están presentes, sin embargo, cuando selecciono dos fechas diferentes en dos segmentaciones de datos, los valores no se muestran correctamente.
He creado esas medidas:
D-Price (EndDate) = CALCULATE(AVERAGE(MergedTables[Price]),FILTER('Sorted Dates', SELECTEDVALUE('Sorted Dates'[EndDate])))
D-Price (StartDate) = CALCULATE(AVERAGE(MergedTables[Price]),FILTER('Sorted Dates', SELECTEDVALUE('Sorted Dates'[StartDate])))
D-Reviews (EndDate) = IF(ISBLANK(CALCULATE(MAX(MergedTables[AmountReviews]),FILTER('EndDates', SELECTEDVALUE('Sorted Dates'[EndDate])))), 0, CALCULATE(MAX(MergedTables[AmountReviews]),FILTER('Sorted Dates', SELECTEDVALUE('EndDates'[EndDate]))))
D-Reviews (StartDate) = IF(ISBLANK(CALCULATE(MAX(MergedTables[AmountReviews]),FILTER('StartDates', SELECTEDVALUE('Sorted Dates'[StartDate])))), 0, CALCULATE(MAX(MergedTables[AmountReviews]),FILTER('Sorted Dates', SELECTEDVALUE('StartDates'[StartDate]))))
Donde la tabla SortedDates es:
Sorted Dates =
ADDCOLUMNS(
DISTINCT(
MergedTables[Date]),
"DateSort", - DATEDIFF ( TODAY (), MergedTables[Date] , DAY ), "StartDate", MergedTables[Date], "EndDate", MergedTables[Date]
)
Y las tablas combinadas tienen un aspecto similar a:
Actividad | Precio | Comentarios | Fecha |
Abecedario | 10 | 10 | 14/08/2022 |
Abecedario | 11 | 10 | 15/08/2022 |
Abecedario | 10 | 11 | 16/08/2022 |
Abecedario | 15 | 12 | 17/08/2022 |
Def | 24 | 150 | 14/08/2022 |
Def | 23 | 150 | 15/08/2022 |
Def | 20 | 150 | 16/08/2022 |
Def | 12 | 151 | 17/08/2022 |
Aaa | 90 | 200 | 14/08/2022 |
Aaa | 345 | 250 | 15/08/2022 |
Aaa | 90 | 300 | 16/08/2022 |
Aaa | 90 | 350 | 17/08/2022 |
La idea es mostrar valores basados en las fechas de inicio y finalización seleccionadas. Ya que a veces me gustaría comparar hoy con ayer y con el valor del mes / año pasado, etc.
Probablemente encontré la solución para mi propio problema. Así que he cambiado la medida a la siguiente. También es muy importante eliminar la conexión entre las tablas combinadas y las tablas que se encuentran en las segmentaciones de datos.
D-Price (EndDate) = CALCULATE(AVERAGE(MergedTables[Price]), FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(EndDates[Date])))
D-Price (StartDate) = CALCULATE(AVERAGE(MergedTables[Price]), FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(StartDates[Date])))
D-Reviews (EndDate) = IF(ISBLANK(CALCULATE(MAX(MergedTables[AmountReviews]),FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(EndDates[Date])))),
0,
CALCULATE(MAX(MergedTables[AmountReviews]),FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(EndDates[Date]))))
D-Reviews (StartDate) = IF(ISBLANK(CALCULATE(MAX(MergedTables[AmountReviews]),FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(StartDates[Date])))),
0,
CALCULATE(MAX(MergedTables[AmountReviews]),FILTER(MergedTables, MergedTables[Date] = SELECTEDVALUE(StartDates[Date]))))