cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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] )) ENDTotal / (The Total of the entire columnar data)

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) :

dax.jpg

Please help me achieve the above functionality in Power BI. Thanks in advanced.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Achieve the dynamic field calculation in Power BI using DAX

@harrypotter,

Please create a new column using the DAX below and check if you get expected result.

 

Total % = if(ISBLANK(SampleData[Total]),BLANK(),SampleData[Total]/sum(SampleData[Total]))

 

1.png

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Achieve the dynamic field calculation in Power BI using DAX

@harrypotter,

Please create a new column using the DAX below and check if you get expected result.

 

Total % = if(ISBLANK(SampleData[Total]),BLANK(),SampleData[Total]/sum(SampleData[Total]))

 

1.png

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
New Member

Re: Achieve the dynamic field calculation in Power BI using DAX

Thanks Lydia for the solution! 🙂 

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors