Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculated Column not working with measures

I need to create a pie chart that shows the Top 5 projects and then groups the rest under "others".   I understand how to write these as measures but I need a calculated column to use as the details in the Pie Chart.   Does anyone know a way to make this work?
Here is my calculated column:

 

Top 5 =
IF(
[Project Rank]<=5,
IssuesList[ProjectName],
"Others"
)

 


Here's an image to show what is happening to the measures.   For the pie chart I would need Top 5 as the Details and Days Worked as the Values.
Example.png
Once I add the Top 5 Calculated column to the mix, Project Ranking breaks.  If I try to make Project Ranking a calculated column, then Days Work breaks inside the calculated column.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Using the blog post below I was abble to achieve necessary value:

 

https://www.proserveit.com/blog/ms-power-bi-topn-and-other

 

Only change was that I created the Top5 and others on the query editor since it was giving me a circularity from dax.

 

You can also make this even more dinamic if you place the Top N as a what if parameter.

 

Check PBIX file attach.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

9 REPLIES 9
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Can we see the formula for measure [Project Rank]?

And please tell us whether the columns referenced in [Project Rank] are fact columns or derived from DAX calculations.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Can we see the formula for measure [Project Rank]?

And please tell us whether the columns referenced in [Project Rank] are fact columns or derived from DAX calculations.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

You cannot use measures on a calculated column try the following:

 

  • Create a table with the following format

DescriptionRank

P1 1
P2 2
P3 3
P4 4
P5 5
Others 6

 

  • Then use the following code for a measure to place in pie chart:
Pie Chart = SWITCH(TRUE(); SELECTEDVALUE('Ranking'[Rank]) = 6 ;CALCULATE([Days_Mea];FILTER('Table';[Rank] >= SELECTEDVALUE( 'Ranking'[Rank])));CALCULATE([Days_Mea];FILTER('Table';[Rank] = SELECTEDVALUE( 'Ranking'[Rank]))))

 

Now create your chart with measure created above in the values and Description of the table created in the legend.

 

Check result in PBIX attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thanks - unfortunately I would not be able to use alias P1, P2, etc in the visual it would need to be the Project Name.

Hi @Anonymous ,

 

Do you need this visual to be interactive with other selections? Like dates, users, whatever?

 

The calculated column is doable however is not dinamic, you can also use a summarized table, once again depending on the filters you need the interaction with other visual is limited.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

We filter by date period, Team, Product, Release and Project so there is alot going.  It doesn't seem like this will be possible to do.

 

Hi @Anonymous ,

 

Using the blog post below I was abble to achieve necessary value:

 

https://www.proserveit.com/blog/ms-power-bi-topn-and-other

 

Only change was that I created the Top5 and others on the query editor since it was giving me a circularity from dax.

 

You can also make this even more dinamic if you place the Top N as a what if parameter.

 

Check PBIX file attach.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

This worked perfectly with all the slicers too - Thanks.

Hi @Anonymous ,

 

Glad I could help has refered you can make the TOP N a dinamic value don't know if for now is needed but keep it in mind.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.