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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

create a pie chart with categories that change with date slicer

Hi,

I have data with customer ids where each row represents transaction info. I am supposed to find average transaction per day for each customer. There is a slicer for date where I can choose last 30 days, or last 7 days. According to the chosen dates, avg per day gets changed. If I just use existing table, there exists an issue of finding correct average. For example, a customer did 10 transactions in only 5 days among our chosen 30 days. We get average here 10/5 instead of 10/30. The only way to solve this is by creating a measure using another table called calender, having one to many relationship with date of existing table. It solves the problem.

 

Now, I need to make a pie chart with categories like less than 0.5 transaction per day on avg, less than 1, less than 2, more than 5 etc. How can I create such categories using just the measure "avg per day". As we can not make a column in the table as avg per day because the column of avg values in the table doesnt change with slicer date (as discussed before eg, last 30 days or last 7 days). I could not figure out how to make categories in pie chart using just a measure here or a table that will change the average values with date slicer. Kindly help me in this!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
You can create a segmentation table ('Buckets') that looks like

Segment Lower Limit Upper Limit
< 0.5 0 0.5
< 1.0 0 1
< 2 0 2
> 2 2 9999999999
> 5 5 9999999999

You can place Buckets[Segment] in the pie chart along with the following measure

Number of Customers =
AVERAGEX (
    Buckets,
    SUMX (
        VALUES ( Data[Customer ID] ),
        VAR AvgPerDay = [avg per day]
        RETURN
            INT ( AvgPerDay >= Buckets[Lower Limit] && AvgPerDay < Buckets[Upper Limit] )
    )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Anonymous 
You can create a segmentation table ('Buckets') that looks like

Segment Lower Limit Upper Limit
< 0.5 0 0.5
< 1.0 0 1
< 2 0 2
> 2 2 9999999999
> 5 5 9999999999

You can place Buckets[Segment] in the pie chart along with the following measure

Number of Customers =
AVERAGEX (
    Buckets,
    SUMX (
        VALUES ( Data[Customer ID] ),
        VAR AvgPerDay = [avg per day]
        RETURN
            INT ( AvgPerDay >= Buckets[Lower Limit] && AvgPerDay < Buckets[Upper Limit] )
    )
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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