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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
jalaomar
Helper IV
Helper IV

Count rows where If statements are true

Hi all,

 

I need to sum up the total of all true statements = 1 for column VSU 5 weeks and in the screenshot you can see that my attempt is not working. How could I fix this?

 

(I don't have 1350 rows in my table as I have filtered out many projects)

 

the column VSU 5 weeks is a true, false statement so it return a string.

 

I would like to get the Total sum for the column with rows = 1

and then I2021-09-29_12-41-02.png would like to divide with the total number of rows in the table to get the %

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @jalaomar 

Because you've filtered out many projects, you need perform the same filtering operation in your measure when you count the rows.

Could you share a sample? so that we can work on it further.

 

 

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.

Greg_Deckler
Super User
Super User

@jalaomar VSU 5 Weeks is a measure so that won't work the way you are doing it. Essentially what you have is a measures total problem. This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler I tried to create a measure but still I am not sure if I have understood how to create this measure fully since it is not working.

 

the value 1 is a string in the measure VSU 5 Weeks and hence not able to use the SUMX.

any suggestions on how to create this measure?

 

My measures are the following in the table 

 

VSU Days = DATEDIFF('KPI'[MIS3.1Actual 2];'KPI'[ITG4Actual2];DAY)
VSU 5 weeks2 = IF(ISBLANK('KPI'[VSU Days]) && 'KPI'[VSU Days]<=35; "0";"1")

 

2021-09-29_18-16-20.png

 

@jalaomar You need to SUMX across a SUMMARIZE or SUMMARIZE columns of you data which mimics how the data in the visual is being summarized.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

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

Sept NL Carousel

Fabric Community Update - September 2024

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