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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Pie chart multiple value dynamically calculated

Hello,

 

I quiet new in DAX and I need your help with this use case.

 

Here is sample data

STATUS_IDFILE_IDSTATUS_DATESTATUS
112020-05-08NEW
222020-05-10NEW
312020-05-10UPDATED
422020-05-11UPDATED
512020-05-12CLOSED
632020-05-12NEW

 

Based on this data, I want to display a Pie Chart with the number of distinct FILE_ID by STATUS. 

But the tricky part ( for my point of view) is :

  1. If a FILE_ID has multiple status it must be count in a status name "MULTIPLE STATUS"
  2. I want to add a slicer to filter by STATUS_DATE

 

The exepecting result based on my sample date is :

  •  if my date slicer is between 2020-05-08 and 2020-05-12 : 2 MULTIPLE STATUS and 1 NEW
  • if my date slicer is between 2020-05-11 and 2020-05-12 : 1 UPDATED, 1 CLOSED and 1 NEW

 

I don't know how to manage that... 

 

Many thanks for your help ! 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

I suggest having a STATUS Table like below.

 

Picture2.png

 

File count by Status =
VAR currentstatus =
MAX ( 'Status'[STATUS] )
VAR multiplestatustable =
SUMMARIZE (
FILTER (
SUMMARIZE (
ALLSELECTED ( Data ),
Data[FILE_ID],
"@statuscount", COUNTROWS ( VALUES ( Data[STATUS] ) )
),
[@statuscount] > 1
),
Data[FILE_ID]
)
VAR notmultiplestatustable =
EXCEPT ( VALUES ( Data[FILE_ID] ), multiplestatustable )
RETURN
SWITCH (
SELECTEDVALUE ( 'Status'[Index] ),
4, COUNTROWS ( multiplestatustable ),
COUNTROWS ( notmultiplestatustable )
)
 
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @Jihwan_Kim  for this quick answer. 

I think the VAR currentstatus is useless since it's not used in the dax formula.

But otherwise it works perfectly ! 

Thanks a lot ! 

 

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

I suggest having a STATUS Table like below.

 

Picture2.png

 

File count by Status =
VAR currentstatus =
MAX ( 'Status'[STATUS] )
VAR multiplestatustable =
SUMMARIZE (
FILTER (
SUMMARIZE (
ALLSELECTED ( Data ),
Data[FILE_ID],
"@statuscount", COUNTROWS ( VALUES ( Data[STATUS] ) )
),
[@statuscount] > 1
),
Data[FILE_ID]
)
VAR notmultiplestatustable =
EXCEPT ( VALUES ( Data[FILE_ID] ), multiplestatustable )
RETURN
SWITCH (
SELECTEDVALUE ( 'Status'[Index] ),
4, COUNTROWS ( multiplestatustable ),
COUNTROWS ( notmultiplestatustable )
)
 
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors