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
SV_community
Frequent Visitor

Ocultar fechas pasadas y futuras en una tabla que no tiene fechas basadas en la fecha máxima y mínima en otra tabla

Hola

Tenemos una tabla de presupuesto que no tiene ningún atributo de fecha. THere es un presupuesto fijo para un proyecto. Se trata estrictamente de una tabla de hechos que contiene varios atributos de presupuesto como Original, Presupuesto actual y Presupuesto proyectado. Hay un requisito de la empresa para poder trazar los gastos/coste y el presupuesto en la misma tabla o gráfico. La tabla de costes (de nuevo una tabla de hechos) tiene la fecha registrada que está conectada a la tabla de calendario.

Así que cuando planteo medidas presupuestarias y de gastos juntas, la gráfica de gastos bien porque tienen una fecha en esa tabla. El Buget comienza desde la fecha más temprana en la tabla Calendario y sale bien en el futuro (esperado ya que no hay ninguna relación con la tabla de calendario).

Se me ha dicho que no agregue ninguna columna calculada en el modelo. Intenté este enfoque documentado aquí. Esto me ayuda a evitar mostrar fechas futuras, pero las fechas mucho antes de que aparezca el mínimo (fecha posterior).

https://www.sqlbi.com/articles/hiding-future-dates-for-calculations-in-dax/

Esto es lo que he intentado hasta ahora:

Coste del presupuesto actual de GC : VAR LastDayAvailable ( GC Current Budget Cost) - VAR LastDayAvailable (VAR LastDayAvailable)
CALCULAR (
MAX ( 'Gasto'[Fecha de referencia] ),
TODO ( 'Calendario' )
)
VAR FirstDayInSelection á Min('Calendar'[Date])
ShowData de VAR ??
(FirstDayInSelection <- LastDayAvailable)
Resultado de VAR (VAR)
IF (ShowData,[GC Current Budget Cost])

Resultado DE DEVOLUCIONES

Cuando sustituyo la variable FirstDayinSelection-CALCULATE (
MIn ( 'Gasto'[Fecha de referencia] ),
TODO ( 'Calendario' )
), de hecho termino con fechas pasadas y futuras apareciendo

Traté de usar Datesween pero no puedo usarlos con varaibles

2 REPLIES 2
parry2k
Super User
Super User

@SV_community cuál es el problema real? ¿Qué intentas lograr? Comparta los datos de muestra y la salida esperada.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

He ajustado el código y ahora funciona. Var ShowData solo filtraba fechas futuras.

Costo del presupuesto actual de GC 2 - VAR LastDayAvailable ?
CALCULAR (
MAX ( 'Detalle del coste del trabajo'[Fecha de referencia]),
TODO ( 'Calendario' )
)
VAR FirstDayInCalendar ?
MIN ( 'Calendario'[Fecha] )
Var MinDayAvailable
CALCULATE(MIN('Job Cost Detail'[Fecha de referencia]), todo ('Calendario'))
ShowData de VAR ??
(FirstDayInCalendar<- LastDayAvailable && FirstDayInCalendar>-MinDayAvailable)
Resultado de VAR (VAR)
SI (
ShowData,
CALCULAR (
[Costo del presupuesto actual de GC]
))

Resultado DE DEVOLUCIONES

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.