Forum Discussion
Mixed Data column
- 2 years ago
Yeah - the trick is to use HASONEVALUE(Table[Total Visits]) or HASONEFILTER(Table[Total Visits]) or ISINSCOPE() in order to identify the totals column - you can see this page for more details: https://www.sqlbi.com/articles/distinguishing-hasonevalue-from-isinscope/
Next is to update your DAX, which you can do in a pattern like:
Measure = IF(HASONEVALUE(Table[Visits]), // your code for calculating the percentage here, // your code for the total here )Ideally, you would keep that as a number, and then use the dynamic format strings to show those number(s) as a percentage in the values, and then a number in your totals. You can use something like:
IF(HASONEVALUE(Table[Visits]), "#0.00%", "#########")Read more about format strings here: https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/.
Hope this helps.
Yeah - the trick is to use HASONEVALUE(Table[Total Visits]) or HASONEFILTER(Table[Total Visits]) or ISINSCOPE() in order to identify the totals column - you can see this page for more details: https://www.sqlbi.com/articles/distinguishing-hasonevalue-from-isinscope/
Next is to update your DAX, which you can do in a pattern like:
Measure = IF(HASONEVALUE(Table[Visits]),
// your code for calculating the percentage here,
// your code for the total here
)
Ideally, you would keep that as a number, and then use the dynamic format strings to show those number(s) as a percentage in the values, and then a number in your totals. You can use something like:
IF(HASONEVALUE(Table[Visits]), "#0.00%", "#########")
Read more about format strings here: https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/.
Hope this helps.