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
leahYan
Advocate II
Advocate II

Total de ejecución en matriz con condición de interruptor dinámico

Hola

Tengo una fórmula DAX para acumular el valor, el total de ejecución y los diferentes períodos totales de horas extras:

R-Acc es el total de carrerasde Acc , R-Com es el total de ejecución de Com. Restante es la diferencia de dos totales en ejecución.

Si no hay datos en mayo, el Remanso no muestra el valor anterior, el total de la columna también está en blanco en el extremo derecho.

La medida Com es similar a Acc, simplemente filtrando otro valor en el mismo campo

Untitled.png

Intenté usar un max(date) para limitar el rango de visualización, pero no hace ningún cambio.

R-Acc ?
var lastd á MAX('Consulta'[fecha])
devolución
IF(SELECTEDVALUE(Query[Daytype])<>"Work Day",
CALCULATE(
[Acc],
FILTRO(
ALL('Date'[Fecha]),
'Fecha'[Fecha]<'lastd'
)
)
Remanso de la red de
SWITCH(SELECTEDVALUE(Query[Category1]),
"1.Ingreso directo",[R-Com]-[R-Acc],
"2.Gasto directo",if(SELECTEDVALUE(Query[Daytype])- "Día de trabajo",BLANK(),[R-Com]-[R-Acc]),
"3.Gross Profit", [R-Com]-[R-Acc]+SUMX(FILTER(Query,[Daytype]-"Work Day"),Query[GrossProfit]*Query[payrate2]/60),
"5.Net Profit",[R-Com]-[R-Acc]+SUMX(QUERY,[Daytype]-"Work Day"),Query[NetProfit]*Query[payrate2]/60)
)
Relación de tabla eQuery y Date como se indica a continuación:

Capture0.PNG

Cualquier pensamiento sería muy agradecido.

¡Gracias!

2 REPLIES 2
Greg_Deckler
Super User
Super User

@leahYan - Extremadamente difícil de seguir. Si estoy leyendo esto correctamente, estoy pensando que esto es lo que necesitas: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-New-Hotness-Custom-Matrix-Hierarchy/m-p/...

Pero, podría estar muy mal. Pero, parece que estás luchando con una matriz y esa es una manera de controlar específicamente una matriz.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg_Deckler,

Thank you for your reply, but I am afraid that's not the issue. The issue is when a month has no data in Acc or Com, the running total of Acc or Com is blank too, which is expecting to show the same value of the previous month. 

I read other solutions for missing values in the running total, and most of them can be solved by refer to a continuous date column in the calendar table instead of the date column in the fact table. 

I applied that in my data model, but it couldn't solve my problem. 

 

thank you very much.

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.