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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
QQQ
Advocate II
Advocate II

DAX to find percent of total based on filter (regardless of view)

How do I create DAX that finds the percent of incidents that are Status=Closed based on row view

 

Sample data from Power Pivot.

 

Total Incidents = Count of CREATED_DATE

 

I tried following Measure both gave error 

 

% Closed:=if(Table1[STATUS]="Closed",[Count of CREATED_DATE],0)/[Count of CREATED_DATE]

 

and

 

% Closed2:=DIVIDE(if(Table1[STATUS]="Closed",[Count of CREATED_DATE],0),[Count of CREATED_DATE],0)

 

sample_data.PNG

 

Here is my table

 

table.PNG

 

 

Here is what I wish to create. Please note, the % of Closed Incidents to Total should change based on how I filter the power-pivot, i.e. if I filter to include ONLY closed incidents, then naturally the % should be 100%

 

output.PNG

 

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@QQQ,

You can create the following measures in your table.

Total incidents = COUNT(Table[CREATE_DATE])
Count of closed = CALCULATE(COUNT(Table[CREATE_DATE]),FILTER(Table,Table[STATUS]="Closed"))
%closed = [Count of closed]/[Total incidents]
1.JPG2.JPG

If you have questions about the DAX, please share raw data of your table that can be copied and pasted, I will test it in my environment.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@QQQ,

You can create the following measures in your table.

Total incidents = COUNT(Table[CREATE_DATE])
Count of closed = CALCULATE(COUNT(Table[CREATE_DATE]),FILTER(Table,Table[STATUS]="Closed"))
%closed = [Count of closed]/[Total incidents]
1.JPG2.JPG

If you have questions about the DAX, please share raw data of your table that can be copied and pasted, I will test it in my environment.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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