Forum Discussion
Anonymous
4 years agoNot applicable
Moving DAX Calculation into PQ for Query Folding
Hello, I'm pretty new to Power Query, I have a table I'm pulling into PBI that was query folding back into SQL Server. I've needed to create a measure as a calculated column in PBI for some visua...
- 4 years ago
Hi Anonymous ,
You can either create a new column in PQ for the variable, or you can include the variable calculation in each line of the new PQ column.
The first option would look like this:
// varColumn ([VOLUME] - [COST] - [WASTE]) / [VOLUME] // newColumn if [varColumn] < 0 then "< 0%" else if [varColumn] < 0.1 then "0-10%" ... ... else //your escape valueThe second option would look like this:
// newColumn if ([VOLUME] - [COST] - [WASTE]) / [VOLUME] < 0 then "< 0%" else if ([VOLUME] - [COST] - [WASTE]) / [VOLUME] < 0.1 then "0-10%" ... ... else //your escape valueBoth options should generate a foldable CASE statement.
Pete
BA_Pete
4 years agoSuper User
Hi Anonymous ,
You can either create a new column in PQ for the variable, or you can include the variable calculation in each line of the new PQ column.
The first option would look like this:
// varColumn
([VOLUME] - [COST] - [WASTE]) / [VOLUME]
// newColumn
if [varColumn] < 0 then "< 0%"
else if [varColumn] < 0.1 then "0-10%"
...
...
else //your escape value
The second option would look like this:
// newColumn
if ([VOLUME] - [COST] - [WASTE]) / [VOLUME] < 0 then "< 0%"
else if ([VOLUME] - [COST] - [WASTE]) / [VOLUME] < 0.1 then "0-10%"
...
...
else //your escape value
Both options should generate a foldable CASE statement.
Pete