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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Oopa
Frequent Visitor

Cómo mantener el valor de la medida igual a lo largo del tiempo

Estoy trabajando datos que tienen dos fact_tables llamadas fact_stat y fact_dyn. Fact_stat solo tiene una fecha unidimensional (report_date) y fact_dyn tiene fechas bidimensionales (report_date & forecast_date). ¿Cómo puedo construir una medida que me da resultados como en la primera imagen a continuación? La medida "Dyn_all" debe mantener fact_stat valor igual durante las fechas de pronóstico. Medidas que estoy usando:

Dyn_all = Fact_dyn[Dyn_sum]+Fact_stat[Stat_sum]
Dyn_sum = SUM(Fact_dyn[Importe])
Stat_sum = SUMA(Fact_stat[Importe])

Desired_result.JPG

Con las medidas actuales sólo puedo ver resultados:
Current_result.JPG

Fact_dyn tabla:

Report_DateForecast_Dateimportecartera
30.4.202030.4.2020100A
30.4.202030.4.2020150B
30.4.202030.4.2020200C
30.4.20201.5.2020150A
30.4.20201.5.2020200B
30.4.20201.5.2020250C
30.4.20202.5.2020200A
30.4.20202.5.2020250B
30.4.20202.5.2020300C

Fact_stat tabla:

Report_Dateimportecartera
30.4.2020400D
15.5.2020200D

Flujo de datos:

data_flow.JPG

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hola @Oopa ,

De acuerdo con su solicitud, es mejor que primero cree una tabla anexa como se muestra a continuación:

Annotation 2020-05-25 143812.png

A continuación, cree una tabla de dimensiones como se indica a continuación:

Table 2 = DISTINCT('Append1'[Portfolio])

Por último, cree 2 medidas como se indica a continuación:

ReplaceToZero = CALCULATE(SUM('Append1'[Amount]),'Append1','Append1'[Portfolio] in DISTINCT('Table 2'[Portfolio]))+0
ReplaceToValue = IF(CALCULATE(COUNTROWS('Append1'),FILTER('Append1','Append1'[Portfolio] in DISTINCT('Table 2'[Portfolio])))=0,MAXX(SUMMARIZE(FILTER(ALLSELECTED('Append1'),'Append1'[Portfolio] in DISTINCT('Table 2'[Portfolio])),'Append1'[Forecast_Date],"measure",CALCULATE(SUM('Append1'[Amount]),FILTER('Append1','Append1'[Portfolio] in DISTINCT('Table 2'[Portfolio])))),[measure]),'Table 2'[ReplaceToZero])

Y verás:

Annotation 2020-05-25 145927.png

Para el archivo .pbix relacionado, haga clic aquí.


Saludos
Kelly
¿Respondí a tu pregunta? ¡Marca mi puesto como solución!

@v-kelly-msft, gracias por su respuesta. Puedo ver los resultados correctos de su powerBI. El único menor es que ahora estamos usando la fecha de previsión e informe de la tabla Append1 y no de dim_report_date o dim_forecast_date. ¿Alguna solución para hacer eso? De lo contrario, esto podría causar problemas si queremos ver otros datos que se unen también a estas tablas de dim_report_date y dim_forecast_date.

parry2k
Super User
Super User

@Oopa compartir datos sin procesar, debe tener dimensión de fecha en el modelo para que todo funcione.



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.

Oopa
Frequent Visitor

@parry2k , ¿Puedo de alguna manera adjuntar el archivo powerbi aquí?

@Oopa compartir usando una unidad / google drive.



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.

Oopa
Frequent Visitor

@parry2k , Los datos de ejemplo son bastante simples:

Fact_dyn:

Report_DateForecast_DateCantidadCartera
30.4.202030.4.2020100A
30.4.202030.4.2020150B
30.4.202030.4.2020200C
30.4.20201.5.2020150A
30.4.20201.5.2020200B
30.4.20201.5.2020250C
30.4.20202.5.2020200A
30.4.20202.5.2020250B
30.4.20202.5.2020300C

Fact_stat:

Report_DateCantidadCartera
30.4.2020400D
15.5.2020200D

Flujo de datos:

data_flow.JPG

amitchandak
Super User
Super User

@Oopa , consulte cómo unir dos fechas a la misma hora atenuar y utilizarlas usando userelation

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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