Forum Discussion
Measure Creation, Column does not exist
Hi all,
I'm having some trouble getting a measure to pick up a column. I'm wanting to convert my Duration Minutes to hh:mm.
Getting the below error, which seem to suggest there is something wrong with my Duration column. I've been able to use it in the reporting without problem, but can't use it in a measure.
Any help would be appriciated
Hi KatsuKun
In measures, columns always have to be in a function.
SelectedValue(table[Column]) lets you return a single value IF that column is being used in the visual.
- Anonymous2 years ago
Hi KatsuKun ,
Based on my testing, if creating a measure to display time, you need to use function to get the column values.
Measure = var _duration = SELECTEDVALUE('Table'[Duration Minutes]) VAR Hours = INT(_duration / 60) VAR Minutes = MOD(_duration, 60) RETURN FORMAT(Hours, "00") & ":" & FORMAT(Minutes, "00")If you want to create a new column to display the time, using your writing dax can success.
Column = VAR Hours = INT([Duration Minutes] / 60) VAR Minutes = MOD([Duration Minutes], 60) RETURN FORMAT(Hours, "00") & ":" & FORMAT(Minutes, "00")You can also view the following documents to learn more information.
Measures in Power BI Desktop - Power BI | Microsoft Learn
Tutorial: Create calculated columns in Power BI Desktop - Power BI | Microsoft Learn
SELECTEDVALUE function - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- SamWiseOwlSuper User
Hi KatsuKun
In measures, columns always have to be in a function.
SelectedValue(table[Column]) lets you return a single value IF that column is being used in the visual.
- AnonymousNot applicable
Hi KatsuKun ,
Based on my testing, if creating a measure to display time, you need to use function to get the column values.
Measure = var _duration = SELECTEDVALUE('Table'[Duration Minutes]) VAR Hours = INT(_duration / 60) VAR Minutes = MOD(_duration, 60) RETURN FORMAT(Hours, "00") & ":" & FORMAT(Minutes, "00")If you want to create a new column to display the time, using your writing dax can success.
Column = VAR Hours = INT([Duration Minutes] / 60) VAR Minutes = MOD([Duration Minutes], 60) RETURN FORMAT(Hours, "00") & ":" & FORMAT(Minutes, "00")You can also view the following documents to learn more information.
Measures in Power BI Desktop - Power BI | Microsoft Learn
Tutorial: Create calculated columns in Power BI Desktop - Power BI | Microsoft Learn
SELECTEDVALUE function - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.