Search code examples
mdxpowerbipercentagedaxpercentile

Achieve the dynamic field calculation in Power BI using DAX


I have a MDX query that needs to be converted in DAX in Power BI. MDX:

CASE WHEN    ISEMPTY( [Measures].[Total] )
                    THEN NULL
                    ELSE
                IIF(
            ISEMPTY( Axis(1).Item(0).Item(0).Dimension.Levels(0).item(0)),1,
[Measures].[Total]  / ( Axis(1).Item(0).Item (0).Dimension.Levels(0).item(0), [Measures].[Total]  )
                                        )
                                        END

I assume that the above query is: Total is Aggregated sum of the data as per month or any dimension and % Total is Total / (The Total of the entire columnar data)

Please see the below screenshot (Sample data):

Sample data screenshot

Does anyone know how to achieve the above functionality in Power BI?


Solution

  • There is a feature in Power BI that shows percent of grand total automatically. Take a look at the screenshots below to get more details Before

    After applying this fetaure you get something like this After