Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
Now, I’m trying to adapt the formula to handle both cases — when equipment is filtered and when no filter is applied:
Confiabilidade_Sistema =
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?
Solved! Go to Solution.
Hi,
Can you try CALCULATETABLE instead of FILTER ?
VAR Equipamentos =
IF(
ISFILTERED(TTF[Equipamento Corrigido]),
VALUES(TTF[Equipamento Corrigido]),
CALCULATEDTABLE(
VALUES(TTF[Equipamento Corrigido]),
NOT(ISBLANK(TTF[a_eq]))
)
)
Hi @Janchieta , Please try the below updated measure:
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(
ALL(TTF[Equipamento Corrigido]),
NOT(ISBLANK(CALCULATE([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
IF(
ISBLANK(t),
BLANK(), -- Handles cases where TTF is not available
1 - PRODUCTX(Confiabilidades, 1 - [Confiabilidade]) -- Calculates system reliability
)
Hi @Janchieta , Please try the below updated measure:
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(
ALL(TTF[Equipamento Corrigido]),
NOT(ISBLANK(CALCULATE([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
IF(
ISBLANK(t),
BLANK(), -- Handles cases where TTF is not available
1 - PRODUCTX(Confiabilidades, 1 - [Confiabilidade]) -- Calculates system reliability
)
Hi,
Can you try CALCULATETABLE instead of FILTER ?
VAR Equipamentos =
IF(
ISFILTERED(TTF[Equipamento Corrigido]),
VALUES(TTF[Equipamento Corrigido]),
CALCULATEDTABLE(
VALUES(TTF[Equipamento Corrigido]),
NOT(ISBLANK(TTF[a_eq]))
)
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |