cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

Community Blog

Community Blog

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

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors