Forum Discussion
Creating measure that acts on all fields
ajk_powerbi you can create one measure and store value in VAR (variables) for each column and then return the result or create 10 measures, there is no other way to achieve it, basically you have to check for each column.
parry2k Thank you! Can you confirm how the return would be written? Here is what I came up with based on your feedback:
% Blank Values =
VAR VFIELD1 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD1]), Excel_SpreadSheet1[FIELD1] = ""),
COUNT(Excel_SpreadSheet1[FIELD1])
)
VAR VFIELD2 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD2]), Excel_SpreadSheet1[FIELD2] = ""),
COUNT(Excel_SpreadSheet1[FIELD2])
)
RETURN
VFIELD1;VFIELD2 <------ This syntax is incorrect, but I would want my graph to show all fields. How do I write the return to show all fields? Thank you.
- ajk_powerbi7 years agoRegular Visitor
parry2k the '&' compiles correctly, but now I'm getting errors based on converting type integers and text. Microsoft Excel seems significantly more intuitive than Power BI, no?
% Blank Values =
VAR VFIELD1 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD1]), Excel_SpreadSheet1[FIELD1] = ""),
COUNT(Excel_SpreadSheet1[FIELD1])
)
VAR VFIELD2 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD2]), Excel_SpreadSheet1[FIELD2] = ""),
COUNT(Excel_SpreadSheet1[FIELD2])
)
RETURN
VFIELD1&VFIELD2- parry2k7 years ago
Super User
ajk_powerbi use format function to convert number to text.
- ajk_powerbi7 years agoRegular Visitor
parry2k Thank you, but more detail please, see below:
% Blank Values =
VAR VFIELD1 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD1]), Excel_SpreadSheet1[FIELD1] = ""),
COUNT(Excel_SpreadSheet1[FIELD1])
)
VAR VFIELD2 = DIVIDE(
CALCULATE(COUNT(Excel_SpreadSheet1[FIELD2]), Excel_SpreadSheet1[FIELD2] = ""),
COUNT(Excel_SpreadSheet1[FIELD2])
)
RETURN
VFIELD1&FORMAT(VFIELD2, ?????)