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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Toufique
Frequent Visitor

Creating a Dynamic Calculated Column to use as chart column label

Hello, 
I want to create a dynamic calculated column which will change the count of number according to my slicer selection. Currently, it showing up the total number from the dataset regardless of slicer filter selection. Like the following screenshot, every person's total case sould add up equal to 192 cases under the current slicer filter selection. However, the numbers for the each persons are showing as the aggregate total from the dataset. 

 

 

 Screenshot 2023-07-18 144047.png

 

here is the following Dax I wrote to make the calculated coulumn: 

Label = [identified] & " (" & (FORMAT([Total Case], "0") & ")")

Any solution regarding to this or alternative way of thinking would be appreciated. Thanks!
6 REPLIES 6
Toufique
Frequent Visitor

Hi @lbendlin , Thanks for looking at my post. Yes, you're right that is essentially a mesure and using measure could solve my problem. However, I want to use this calculated column as an X axis for my column/bar chart. Since I cannot use measure as an X axis, I need to have either a regular column/calculated column to show my audience their relevant total amount based off of the filter selection. 

I added one Power BI File , where I tried to wirte a calculated column for the sales person which supposed to ideally show the relevant number based off of the slicer selection. I also include one card visual which is showing the total sum. In that case, the total sum of all columns should match that number. 

 

I am afraid of Power bi may not allow what I was trying to accomplish, but alternative solution with similar outcome would be appreciated. 

If you know the expected range of the measure you can use a disconnected table with the respective buckets to feed the X axis of your visual. In your case the buckets are undefined since your are adding the product count.  

 

You may need to use a different visual , or indeed do this outside of Power BI.

 

Based on the sample data you provided - what would be the expected outcome?

Note:  Joining on the Product Name is unfortunate. Would be better if the Sales Table had a Product Key column.

The expected outcome would match the numbers just like the table showing the breakdown of each sales person Total Product Sales. Such as Aaron should have "Aaron (6)", Abby should have "Abby (2)" etc. 

 

 

Screenshot 2023-07-20 125839.png 

You need to abandon that idea, it is not possible in Power BI.  What you can do instead is put the [Total Product] measure in the tooltips.

Ok, thanks for the reply.

lbendlin
Super User
Super User

I want to create a dynamic calculated column

That's called a measure.

 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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