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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jayPBI23
Helper I
Helper I

Calcular un campo de fecha basado en un filtro

jayPBI23_0-1595343920145.png

Si un usuario selecciona este intervalo de fechas liquidadas,

Quiero que el CR001_Reporting_Period_Start_Date coincida con '6/1/2020' &

CR001_Reporting_Period_Start_Date coincidir con '6/30/2020'

Así que más o menos actualizar dinadicmente el campo a lo que el usuario seleccionado en el filtro. ¿Es posible?

Gracias por cualquier ayuda de antemano!

Jay

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hola, @jayPBI23

Según su descripción, creé fechado para reproducir su escenario. El archivo blix se adjunta al final.

Mesa:

e1.png

Calendario (una tabla calculada):

Calendar = CALENDAR(DATE(2020,6,1),DATE(2020,12,31))

No hay ninguna relación entre dos tablas. Puede crear dos medidas como se indica a continuación.

CR001_Reporting_Period_Start_Date = 
CALCULATE(
    MIN('Calendar'[Settled Date]),
    ALLSELECTED('Calendar'[Settled Date])
)

CR001_Reporting_Period_End_Date = 
CALCULATE(
    MAX('Calendar'[Settled Date]),
    ALLSELECTED('Calendar'[Settled Date])
)

Resultado:

e2.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

@jayPBI23 , Probar como

medida :
var _max á maxx(allselected(Date),Date[Date])
var _min á minx(allselected(Date),Date[Date])
return calculate(sum(Table[column]), filter(Allselected(Table),Table[CR001_Reporting_Period_Start_Date]-_min && Table[CR001_Reporting_Period_Start_Date]-_max))

medida :
var _max á maxx(allselected(Date),Date[Date])
var _min á minx(allselected(Date),Date[Date])
return calculate(sum(Table[column]), all(Table[Settled Date]),filter(Table,Table[CR001_Reporting_Period_Start_Date]-_min && Table[CR001_Reporting_Period_Start_Date]-_max))

Hola Amit.

No uso tanto a Dax. Intentar usar tu código sigue teniendo errores. Aquí hay algunos detalles.

Tabla ' 'Query1'

Campo de segmentación de fechas : 'SettledDate'

CR0001_Reporting_Period_start_Date debe ser '6-1-2020' basado en el filtro de fecha de liquidación

CR0002_Reporting_Period_End_Date debe ser '6-30-2020' basado en el filtro de fecha de liquidación

¿Qué es exactamente la medida?

¡Muchas gracias!

Jay

camargos88
Community Champion
Community Champion

Hola @jayPBI23,

Vas a necesitar 2 medidas aquí, obteniendo min y max de la fecha seleccionada, algo así como:

Medidas 1

VAR _dtStart á MINX(TABLE[DATE], [DATE])

RETURN CALCULATE(SUM(TABLE[VALUES]), FILTER(ALL(TABLE([DATE]), [DATE] Á _DT_START))

Medidas 1

VAR _dtEnd MAXX(TABLE[DATE], [DATE])

RETURN CALCULATE(SUM(TABLE[VALUES]), FILTER(ALL(TABLE([DATE]), [DATE] Á _DTEND))



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



No uso tanto a Dax. Intentar usar tu código sigue teniendo errores. Aquí hay algunos detalles.

Tabla ' 'Query1'

Campo de segmentación de fechas : 'SettledDate'

CR0001_Reporting_Period_start_Date debe ser '6-1-2020' basado en el filtro de fecha de liquidación

CR0002_Reporting_Period_End_Date debe ser '6-30-2020' basado en el filtro de fecha de liquidación

¿Qué es exactamente la medida?

¡Muchas gracias!

Jay

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors