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
vslaser
Helper I
Helper I

Ree calcular la medida para las fechas identificadas

Hola a todos

Tengo un esquema en el que varias tablas están conectadas y tengo una tabla de medidas en estas tablas. La tabla de claves de este esquema es una tabla de órdenes de trabajo (WOs) que tiene una lista de fechas en las que se enumeran las órdenes de trabajo.

vslaser_0-1600156868108.png

Ahora he generado una tabla de fechas de inicio y finalización. Quiero volver a calcular una medida para estas fechas como max y min filtrando la tabla WOs.

vslaser_1-1600156892870.png

Probé esto usando la siguiente fórmula, pero no obtuve ningún resultado (Sólo en blanco):

calcular(
calculate([Availability_product general del sistema]),
FILTER(WOs,(SELECTEDVALUE(WOs[REPORTDATE+Time])>-SELECTEDVALUE('Table'[Start])) &&
(SELECTEDVALUE(WOs[REPORTDATE+Time])<-SELECTEDVALUE('Table'[End]))),
ALLSELECTED('Test Freq + Config'[SECE Group]), ALLSELECTED(Measures_Table))
Probé esto con el filtro eliminado y obtuve el resultado general sin tener en cuenta las fechas de inicio y finalización. Sin embargo, quiero filtrar los datos de WOs para las fechas de inicio y finalización e ignorar la segmentación de datos en la página. Cualquier ayuda sería muy apreciada.
Gracias
Vijay
1 ACCEPTED SOLUTION

I found the perfect solution for this issue. Here are 2 measures I wrote to arrive at the answer:

 

measure 1: 

Var MinDate = values('Table'[Start])
Var MaxDate = values('Table'[End])
Var No_apm_failfix = CALCULATE(calculate(COUNT(WOs[APM_FAILFIX]),(WOs[APM_FAILFIX]= "APMFAIL" || WOs[APM_FAILFIX]= "APMFAILFIX" )),ALLSELECTED('Test Freq + Config'[SECE Group]),WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var No_CM = CALCULATE(CALCULATE(COUNT(WOs[WORKTYPE]), (WOs[CM_HASRAF] == "CMY")), WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var calc_dt = CALCULATE(sum(WOs[DOWNTIME]), (WOs[CM_HASRAF] == "CMY"), WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var date_diff = DATEDIFF(MinDate, MaxDate, DAY)
Var pop = calculate(SUM('Test Freq + Config'[Sum of Pop Counts]), REMOVEFILTERS(WOs[REPORTDATE+Time]))
Var hidden_fail = IFERROR(CALCULATE(No_apm_failfix/(date_diff*pop)),1)
Var hidden_av = iferror(if(hidden_fail>0, (1-(exp(-(hidden_fail*sum('Test Freq + Config'[Test Freq])))))/(hidden_fail*sum('Test Freq + Config'[Test Freq])),1),1)
Var CM_unav = if(calc_dt == 0,0,if(pop == 0, 0,calculate(calc_dt/(date_diff*pop),WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate)))
Var element_av = IFERROR(calculate(hidden_av - CM_unav),1)
// Var comb_av = calculate(
// if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), element_av,if((values('Test Freq + Config'[Configuration]) == "2oo2"), power(element_av,2), if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power(1-element_av,2)),if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power(element_av,3) - 3*power(element_av,4)),0))))), ALLSELECTED('Test Freq + Config'[SECE Group]),WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate)
Var overall =


CALCULATE(PRODUCTX(
    KEEPFILTERS(values('Test Freq + Config'[RBD Group])),
    CALCULATE(calculate(
if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), element_av,
if((values('Test Freq + Config'[Configuration]) == "2oo2"), power(element_av,2),
if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,
if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power((1-element_av),2)),
if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power(element_av,3) - 3*power(element_av,4)),1))))),
WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate))
))

return
element_av
 
 
final measure: 
CALCULATE(PRODUCTX(
    KEEPFILTERS(values('Test Freq + Config'[RBD Group])),
    CALCULATE(calculate(
if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), [Calculated],
if((values('Test Freq + Config'[Configuration]) == "2oo2"), power([Calculated],2),
if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,
if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power((1-[Calculated]),2)),
if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power([Calculated],3) - 3*power([Calculated],4)),1))))))
)))

View solution in original post

12 REPLIES 12
amitjzaveri
Resolver II
Resolver II

¿Estás buscando una consulta como esta?

CALCULATE(
CALCULATE([Sistema general Availability_product],DATESBETWEEN(WOs[REPORTDATE+Time], MAX('Table'[Start]),MAX('Table'[End])),ALLSELECTED('Table'))
,ALL('Test Freq + Config'[GRUPO SECE]), ALL(Measures_Table))

Creo que esto dará un re-cálculo para min y max para las 2 columnas. Esperaba obtener un valor para cada fila. Espero que esto tenga sentido. Gracias. Disculpas

amitchandak
Super User
Super User

@vslaser, no muy claro.

¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla? O una muestra de pbix después de eliminar datos confidenciales.

@Amit, can you please send me a contact method? I am unable to upload the pbix file here. What I want to do is to generate a trend with the value re-calculated for each date range in the rows of this table. At the moment, it is not taking into consideration the start and end dates in the table which is why the value remains unchanged in the rows

Hi @amitchandak , 

 

Please find the file at the below link:

 

https://drive.google.com/file/d/17ma0SUX4Kx9X9AGwSyXq2VLX39C_H7Ev/view?usp=sharing

 

Any help would be deeply appreciated.

 

Thanks,

Vijay

Hola

Por favor, comparta el resultado exacto que está esperando.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@vslaser Usa esta fórmula y supongo que funciona según tus necesidades

Calculated = calculate([Overall System Availability_product],DATESBETWEEN(Measures_Table[Date], MAX('Table'[Start]),MAX('Table'[End])),ALLSELECTED(WOs),ALL('Test Freq + Config'[SECE Group]))

No estoy seguro de por qué ha utilizado "ALLSELECTED(WOs)" pero lo mantuve como está. Y como se mencionó anteriormente DATESBETWEEN le ayudará a filtrar filas por fechas dadas

bi.png

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

¡Salud!


@vslaser escribió:

Hola @amitchandak ,

Por favor, encuentre el archivo en el siguiente enlace:

https://drive.google.com/file/d/17ma0SUX4Kx9X9AGwSyXq2VLX39C_H7Ev/view?usp=sharing

Cualquier ayuda sería muy apreciada.

Gracias

Vijay


@amitjzaveri , the solution you provided is only working for 1 of the SECEs and not for others and the values dont seem to be for all the ones in table columns 😞

Hi all,

 

I used the below formula and am getting a value for each of the rows in the 'Table' table. These values however are still wrong. 

 

calculate( [Overall System Availability_product],
FILTER(ALLSELECTED(WOs),
(
((WOs[REPORTDATE+Time]>=SELECTEDVALUE('Table'[Start]))) &&
(WOs[REPORTDATE+Time]<=SELECTEDVALUE('Table'[End]))
)),
ALLSELECTED('Test Freq + Config'[SECE Group])
)
 
Regards,
Vijay

I found the perfect solution for this issue. Here are 2 measures I wrote to arrive at the answer:

 

measure 1: 

Var MinDate = values('Table'[Start])
Var MaxDate = values('Table'[End])
Var No_apm_failfix = CALCULATE(calculate(COUNT(WOs[APM_FAILFIX]),(WOs[APM_FAILFIX]= "APMFAIL" || WOs[APM_FAILFIX]= "APMFAILFIX" )),ALLSELECTED('Test Freq + Config'[SECE Group]),WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var No_CM = CALCULATE(CALCULATE(COUNT(WOs[WORKTYPE]), (WOs[CM_HASRAF] == "CMY")), WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var calc_dt = CALCULATE(sum(WOs[DOWNTIME]), (WOs[CM_HASRAF] == "CMY"), WOs[REPORTDATE+Time]<=MaxDate, WOs[REPORTDATE+Time]>=MinDate)
Var date_diff = DATEDIFF(MinDate, MaxDate, DAY)
Var pop = calculate(SUM('Test Freq + Config'[Sum of Pop Counts]), REMOVEFILTERS(WOs[REPORTDATE+Time]))
Var hidden_fail = IFERROR(CALCULATE(No_apm_failfix/(date_diff*pop)),1)
Var hidden_av = iferror(if(hidden_fail>0, (1-(exp(-(hidden_fail*sum('Test Freq + Config'[Test Freq])))))/(hidden_fail*sum('Test Freq + Config'[Test Freq])),1),1)
Var CM_unav = if(calc_dt == 0,0,if(pop == 0, 0,calculate(calc_dt/(date_diff*pop),WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate)))
Var element_av = IFERROR(calculate(hidden_av - CM_unav),1)
// Var comb_av = calculate(
// if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), element_av,if((values('Test Freq + Config'[Configuration]) == "2oo2"), power(element_av,2), if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power(1-element_av,2)),if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power(element_av,3) - 3*power(element_av,4)),0))))), ALLSELECTED('Test Freq + Config'[SECE Group]),WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate)
Var overall =


CALCULATE(PRODUCTX(
    KEEPFILTERS(values('Test Freq + Config'[RBD Group])),
    CALCULATE(calculate(
if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), element_av,
if((values('Test Freq + Config'[Configuration]) == "2oo2"), power(element_av,2),
if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,
if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power((1-element_av),2)),
if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power(element_av,3) - 3*power(element_av,4)),1))))),
WOs[REPORTDATE+Time]>=MinDate, WOs[REPORTDATE+Time]<=MaxDate))
))

return
element_av
 
 
final measure: 
CALCULATE(PRODUCTX(
    KEEPFILTERS(values('Test Freq + Config'[RBD Group])),
    CALCULATE(calculate(
if((VALUES('Test Freq + Config'[Configuration]) == "1oo1"), [Calculated],
if((values('Test Freq + Config'[Configuration]) == "2oo2"), power([Calculated],2),
if((values('Test Freq + Config'[Configuration]) == "N/A"), 1,
if((values('Test Freq + Config'[Configuration]) == "1oo2"),(1 - power((1-[Calculated]),2)),
if((values('Test Freq + Config'[Configuration]) == "3oo4"), (4*power([Calculated],3) - 3*power([Calculated],4)),1))))))
)))

Thanks @amitchandak ,

 

I tried the solution you gave me but it looks like it now does not change with the selection of SECE group in the page. The same result is displayed for all SECE groups 😞

 

@Ashish_Mathur : The result I expected was:

recalculated values of the verall availability for the given dates for the selected SECE group. Unfortunately, I am unable to calculate them here because even with the help @amitchandak provided, the result is not specific to the SECE group. 😞

 

Regards,

Vijay

Gracias Amit. Compartiré una muestra

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.