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
brohon
Frequent Visitor

Stacked bar chart with the part of total

Hi Everyone,

 

don't you know if it is possilbe that the filter on the dashboard would affect only one of the values in the graph?

 

I have two tables - customers, transactions.

 

Customer

 

Customer ID    |  Full name                  |    Registration date

1                        Ned Stark                        1.3.2014

2                        Jamie Lannister               4.5.2016

3                        Jon Snow                         7.7.2016

 

Transactions

 

Transaction ID    |  Customer ID   |   Date          | Salesman   

1                             1                       1.1.2016         Scot

2                             2                       3.5.2016         Joe

3                             1                      7.7.2017         Joe

4                             3                      7.7.2017         Mike

 

What I'd like to achieve is to have a Slicer that would allow me to filter the dates in which some transactions occured.

 

Below I'd like to have the stacked column chart, with the Year of Customers' registration date on the X axis and two values:

1. Cout of customers who had a transaction by selected period (no problem with that)

2. All customers who registered in the year (this makes me trouble, because the customers are filtered out by the slicer above)

 

The Graph should look like something like this:

 

pbx.jpg

 

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @brohon,

 

 

 

I think it is impossible to achieve your requirmetn, if slicer not has any filter effect to current table, it means dax formula can't get the current value form slicer. it will return the wrong result.

 

Sample:

1.PNG

 

Count customers who has transaction in selected range works, but count register customers not works.(it only return the static value)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
parry2k
Super User
Super User

try by adding following measure

 

Total Customers = Calculate(Count(Customer[Customer Id]), AllSelected(Customer))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi,

 

I've tried your solution but it calculated all customers (not considering the date of registration) and in the graph the same value displayed for each year of registration.

 

Therefore I modified the Measure to Total Customers = TOTALYTD(COUNT(Customer[Customer Id]);Customers[Registration date];All(Customer)).

 

This helped to split Counted number between the years of registration. However, it did not solve the problem that the calculated amount is still related to the slicer filter at the dashboard - Transaction[Transaction date].

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.