Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
corange
Post Patron
Post Patron

Calcular la diferencia del valor en la misma columna y en función de los datos de otra

Hola POWER BI Team,

Necesito tu ayuda y haré todo lo posible para ser claro.

Mi conjunto de datos tiene tres columnas principales CLIENT, DATE (Text) y ORDER(Numeric). Cuando dejo caer la columna en un MATRIX, esto es lo que obtengo:

Capture12.PNG

Usando DAY como filtro, voy a comparar un DÍA a la vez con HOY. Me gustaría poder calcular la diferencia y el porcentaje de diferencia en EL ORDEN entre el valor de hoy y el valor del lunes y para que la medida se actualice cuando selecciono cualquier otro día de la semana. Siempre voy a comparar cualquier DIA con HOY.

Aquí el resultado deseado:

Capture13.PNG

¿Hay alguna manera de lograr esto usando DAX tal vez? En caso afirmativo, ¿puede alguien ayudarme a alcanzar el resultado deseado?

Gracias de antemano.

3 REPLIES 3
amitchandak
Super User
Super User

@corange , ¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla?

ver si estos dos pueden traer algo de ayuda

Power BI — Preguntas WTD— Inteligencia de tiempo 4–5
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
Power BI — Preguntas de inteligencia diurna — Time Intelligence 5–5
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5c3243d...

Hola ,

Aquí mi muestra: https://1drv.ms/u/s!AiS7XVNuQsBCbslVeWs3M66_7po?e=C3CSAB

Aquí una tabla de lo que me gustaría lograr:

Etiquetas de filaLunesHoyDiferencia% Etiquetas de filaMartesHoyDiferencia%
Cliente 11 -1-100% Cliente 11 -1-100%
Cliente 131100% Cliente 114 -4-100%
Cliente 151 -1-100% Cliente 131100%
Cliente 31 -1-100% Cliente 141 -1-100%
Cliente 44 -4-100% Cliente 21 -1-100%
Cliente 51.2520.7560% Cliente 42.25 -2.25-100%
Cliente 72.675.002.3387% Cliente 52200%
Cliente 81 -1-100% Cliente 61 -1-100%
Cliente 91 -1-100% Cliente 7154400%
Cliente 82 -2-100%

hola @corange

Pruebe de esta manera como se indica a continuación:

Paso 1:

Agregue una columna BookingDayNo en la tabla.

Step2:

Cree dos medidas como se indica a continuación:

Difference = 
var _firstday=CALCULATE(MIN('Table'[BookingDayNo]),ALLSELECTED('Table'))
var _lastday=CALCULATE(MAX('Table'[BookingDayNo]),ALLSELECTED('Table'))
return
CALCULATE(SUM('Table'[OrderNumber]),FILTER(ALL('Table'[BookingDayName],'Table'[BookingDayNo]),'Table'[BookingDayNo]=_lastday))-CALCULATE(SUM('Table'[OrderNumber]),FILTER(ALL('Table'[BookingDayName],'Table'[BookingDayNo]),'Table'[BookingDayNo]=_firstday))


% = 
var _firstday=CALCULATE(MIN('Table'[BookingDayNo]),ALLSELECTED('Table'))
var _lastday=CALCULATE(MAX('Table'[BookingDayNo]),ALLSELECTED('Table'))
return
DIVIDE(CALCULATE(SUM('Table'[OrderNumber]),FILTER(ALL('Table'[BookingDayName],'Table'[BookingDayNo]),'Table'[BookingDayNo]=_lastday))-CALCULATE(SUM('Table'[OrderNumber]),FILTER(ALL('Table'[BookingDayName],'Table'[BookingDayNo]),'Table'[BookingDayNo]=_firstday)),CALCULATE(SUM('Table'[OrderNumber]),FILTER(ALL('Table'[BookingDayName],'Table'[BookingDayNo]),'Table'[BookingDayNo]=_firstday)))

Resultado:

2.JPG

Por cierto, no podría lograr que agregar columna personalizada al final de la matriz visual, por lo que es mejor ponerlos en dos objetos visuales

saludos
Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.