"values"
2 TopicsError with VALUES Function When No Filter is Applied and Issue with ADDCOLUMNS in DAX Measure
I'm trying to create a DAX measure that calculates reliability, but I’m encountering an issue. The goal is to make the measure work when one or more equipment items are selected. However, when no equipment filter is applied, it throws an error in the graph. I need help adapting the formula to handle this case properly. Here’s the original code: Confiabilidade_Sistema = VAR t = SELECTEDVALUE(Tabela_TTF[TTF]) -- Time to failure (in hours) VAR Equipamentos = VALUES(TTF[Equipamento Corrigido]) VAR Confiabilidades = ADDCOLUMNS( Equipamentos, "Confiabilidade", VAR Beta = CALCULATE([b_eq], TTF[Equipamento Corrigido] = EARLIER(TTF[Equipamento Corrigido])) VAR Eta = CALCULATE(EXP(-[a_eq] / Beta), TTF[Equipamento Corrigido] = EARLIER(TTF[Equipamento Corrigido])) RETURN IF(NOT(ISBLANK(Beta)) && NOT(ISBLANK(Eta)), EXP(-POWER(t / Eta, Beta)), 1) ) RETURN 1 - PRODUCTX(Confiabilidades, 1 - [Confiabilidade]) Now, I’m trying to adapt the formula to handle both cases — when equipment is filtered and when no filter is applied: Confiabilidade_Sistema = VAR t = SELECTEDVALUE(Tabela_TTF[TTF]) -- Time to failure (in hours) VAR Equipamentos = IF( ISFILTERED(TTF[Equipamento Corrigido]), VALUES(TTF[Equipamento Corrigido]), FILTER( VALUES(TTF[Equipamento Corrigido]), NOT(ISBLANK(TTF[a_eq])) ) ) VAR Confiabilidades = ADDCOLUMNS( Equipamentos, "Confiabilidade", VAR Beta = CALCULATE([b_eq], TTF[Equipamento Corrigido] = EARLIER(TTF[Equipamento Corrigido])) VAR Eta = CALCULATE(EXP(-[a_eq] / Beta), TTF[Equipamento Corrigido] = EARLIER(TTF[Equipamento Corrigido])) RETURN IF(NOT(ISBLANK(Beta)) && NOT(ISBLANK(Eta)), EXP(-POWER(t / Eta, Beta)), 1) ) RETURN 1 - PRODUCTX(Confiabilidades, 1 - [Confiabilidade]) -- Calculates system reliability However, it returns the following error: "The ADDCOLUMNS function expected a table expression for the '' argument, but a string or numeric expression was used." The issue arises when no equipment is selected. If any equipment is selected, the graph works fine. Could you help me fix this issue?Solved727Views1like2CommentsTop 3 flags being removed
Hi, I'm needing help with a measure to get the top 3 support needs being removed on a month to month basis. I have a transactional table, "CUSTOMER_FLAGS" with customers, "CUSTOMER_FLAGS"[Customer], that have flags against them for support needs "CUSTOMER_FLAGS"[FLAG_ID]. Customers can have one or more flags against them. I have a date table "DATE"[Date], and relevant date columns in my table connected to this are "CUSTOMER_FLAGS"[ACTIVE_AT], "CUSTOMER_FLAGS"[EXPIRES_AT]. The "DATE"[Date] column is connected to "CUSTOMER_FLAGS"[ACTIVE_AT]. I also have "FLAG_REFERENCE" table with "FLAG_REFERENCE"[FLAG_NAME] to define what the flags are, [FLAG_ID] '103' = FLAG_NAME 'I need help with reading' etc and is connected via "FLAG_REFERENCE"[FLAG_ID] to "CUSTOMER_FLAGS"[FLAG_ID]. I need to see on a month to month basis, the top 3 support needs that are being removed; this is to see which support needs customers are needing less over time. I have struggled with this as it's both needing to get the support needs that are being removed over time, not the number of customers, but also with the added necessity to see it as the top 3 being removed. Many thanks in advance, Data-Papa.429Views0likes1Comment