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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
brizzdizz
Frequent Visitor

30/60/90 pie chart based on criteria

Hi, I'm trying to create a 30/60/90 pie chart that shows the number of unpaid invoices where:
1) <30 = 1-29 days, 30 = 30-59 days, 60 = 60-89 days, >90 = 90+ days

2) It only includes the invoice in the calculation when "Payment Amount" is blank

 

Sample data:

brizzdizz_1-1654793372264.png

 

 

1 ACCEPTED SOLUTION

Hi @brizzdizz 

Thanks for your reply.

When day>90, _end returned null, so I added if(). Try this measure,

Measure = 
var _start= MIN(days[day])
var _end= MINX(FILTER(all(days),days[day]>_start),days[day])
return IF(_end<>BLANK(),CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[daydiff]>=_start && 'Table'[daydiff]<_end)),CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[daydiff]>=_start )))

vxiaotang_0-1655371350397.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

4 REPLIES 4
brizzdizz
Frequent Visitor

Thank you so much. This is very close but I noticed my measure for >90 wasn't picking anything up. For my data I expect to have 116 in the >90 category but nothing is shown. In checking the "pie chart based on criteria.pbix" file that was attached, I see it has the same issue where the 187 daydiff should have been picked up as >90 but it wasn't. I've made changes to the measure to attempt to get it to work but haven't been successful. Any ideas?

brizzdizz_0-1655326052866.png

brizzdizz_1-1655326111522.png

 

Hi @brizzdizz 

Thanks for your reply.

When day>90, _end returned null, so I added if(). Try this measure,

Measure = 
var _start= MIN(days[day])
var _end= MINX(FILTER(all(days),days[day]>_start),days[day])
return IF(_end<>BLANK(),CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[daydiff]>=_start && 'Table'[daydiff]<_end)),CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[daydiff]>=_start )))

vxiaotang_0-1655371350397.png

 

Best Regards,

Community Support Team _Tang

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

This worked perfectly. Thank you!

v-xiaotang
Community Support
Community Support

Hi @brizzdizz 

Thanks for reaching out to us.

You can try this,

(1) create the table first

vxiaotang_1-1655089427482.png

(2) create the measures below

daydiff = IF(ISBLANK(MIN('Table'[Payment Amount])),DATEDIFF(MIN('Table'[Payment Due Date]),TODAY(),DAY))
Measure = 
var _start= MIN(days[day])
var _end= MINX(FILTER(all(days),days[day]>_start),days[day])
return CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[daydiff]>=_start && 'Table'[daydiff]<_end))

 

result

vxiaotang_2-1655089493597.png

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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