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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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!:
The Definitive Guide to Power Query (M)

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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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