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
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!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors