Forum Discussion
Create calculated row
- 8 years ago
try this
EDIT - removed inactive link, uploaded the sample file
- 8 years ago
assuming there is Tax% in classification table
you create a new measure defining the new ratioRatioTax := DIVIDE ( CALCULATE ( [RegularSum], ALL ( 'Classification'[Classification] ), 'Classification'[Classification] = "Trading Income" ), CALCULATE ( [RegularSum], ALL ( 'Classification'[Classification] ), 'Classification'[Classification] = "Taxation" ) )and adjust the final measure
SumAndRatio:= VAR varClassification = UPPER(IF(HASONEVALUE(Classification[Classification]),VALUES(Classification[Classification]),BLANK())) RETURN SWITCH(varClassification, "COS%",[RatioCoS], "Tax%",[RatioTax], [RegularSum] )
etc.
you could also consider extending the classification table with the definions of ratios, and use that as more general pattern, e.g.RatioFlag Classification Nominator Denominator FALSE Trading Income NA NA FALSE Cost of Sales NA NA FALSE Taxation NA NA TRUE CoS% Trading Income Cost of Sales TRUE Tax% Trading Income Taxation Ratio = VAR Nom = SELECTEDVALUE(Classification[Nominator]) VAR Denom = SELECTEDVALUE(Classification[Denominator]) RETURN DIVIDE ( CALCULATE ( [RegularSum], ALL ( 'Classification'[Classification] ), 'Classification'[Classification] = Nom ), CALCULATE ( [RegularSum], ALL ( 'Classification'[Classification] ), 'Classification'[Classification] = Denom ) )SumAndRatio = VAR varRatioFlag = IF(HASONEVALUE(Classification[RatioFlag]),VALUES(Classification[RatioFlag]),BLANK()) RETURN IF(varRatioFlag,[Ratio],[RegularSum])
Hi ,
I have created classification table want sorting of classification but when i sort classification by order then calculated rows are not showing values ,
How to sort classification column with all Values.
Below is my classification table with order :
In this kpis column yield% and Total input are mesure or insrted rows :
when I try to sort kpis by order then yield% and Total input becomes null, why ?how to resolve this issue ?
Regards ,
Pooja
when custom sort order is used the order column is treated as if it was added to the visual, you need to account for that in the code
basically instead of
ALL ( 'Classification'[Classification] )
you need to use
ALL ( 'Classification'[Classification], 'Classification'[Order] )
or
ALL('Classification')