Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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]))
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |