Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hola a todos,
He estado trabajando en una tabla, en la que la resolución de la fecha se puede cambiar con un grupo de parámetros de día a semana a mes, de la siguiente manera:
Al mismo tiempo, he implementado un KPI personalizado, que verifica la fecha anterior (día, al parecer), y si hay un aumento en el valor del campo, genera una flecha hacia arriba; Si el valor disminuye, devuelve una flecha hacia abajo y, si la diferencia es 0, genera un círculo.
Basándome en la misma lógica, también he hecho una medida para el color de la fuente (verde, rojo, negro).
La lógica es la siguiente:
(1) Compruebo los datos el día anterior (1ª medida):
previous_interval_reported_examinations =
CALCULATE(
SUM( 'APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day] )
,PREVIOUSDAY( DateWithWeeks[Date] )
)
(2) Determino la diferencia y devuelvo las flechas:
arrow_performed_ex_during_the_day =
VAR _difference =
SUM('APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day]) -
[previous_day_reported_examinations]
VAR _currentDate = MAX(DateWithWeeks[Date])
VAR _direction =
SWITCH(
TRUE(),
_difference > 0, "▲",
_difference < 0, "▼",
"⬤"
)
RETURN
IF (
_currentDate >= DATE(2023, 7, 1) && _currentDate <= MAX('APTRISPL FACT_examinations_report_2'[date]),
_direction,
BLANK() -- Return blank if the date is outside the desired range
)
(3) finalmente, como en el anterior, devuelvo un valor hexadecimal para colorear, que se usa en un valor de campo de formato condicional:
timeseries_colour =
VAR
_difference = SUM( 'APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day] ) - [previous_day_reported_examinations]
RETURN
SWITCH(
TRUE()
, _difference > 0, "#348939"
, _difference < 0, "#9B1D1E"
, "#000000"
)
Mi pregunta es: funciona con días, pero me pregunto si puede seguir la "resolución" de los grupos de parámetros, por lo que si se selecciona mes, se compararán los meses.
¡Muchas gracias por su ayuda de antemano!
Simon
SELECTEDNO funciona con parámetros de campo. Utilice el siguiente patrón:
VAR Selected =
SELECTCOLUMNS (
SUMMARIZE ( 'Parameter', 'Parameter'[Parameter], 'Parameter'[Parameter Fields] ),
"Parameter", 'Parameter'[Parameter]
)
Mientras tanto, he estado tratando de hacer una medida, que cambia el intervalo, correspondiente al campo seleccionado en el parámetro; Y hasta aquí llegó con esto:
previous_interval_reported_examinations =
VAR SelectedInterval = SELECTEDVALUE(dateResolutionSwitch[dateResolutionSwitch Fields])
RETURN
SWITCH(
SelectedInterval,
"Date",
CALCULATE(
SUM('APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day]),
PREVIOUSDAY(DateWithWeeks[Date])
),
"Week Number and Year",
CALCULATE(
SUM('APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day]),
DATEADD(DateWithWeeks[Date], -7, DAY)
),
"YearMonthShort",
CALCULATE(
SUM('APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day]),
PREVIOUSMONTH(DateWithWeeks[Date])
),
"Year",
CALCULATE(
SUM('APTRISPL FACT_examinations_report_2'[performed_examinations_during_the_day]),
PREVIOUSYEAR(DateWithWeeks[Date])
),
BLANK()
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |