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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
davidsimm10
Frequent Visitor

Sum error

DaysAbove = what-if parameter

 

I have a tabular table with Date and CountID and a DaysWhereFlag. (If the count of that ID goes over the 'DaysAbove')

 

DaysWhereFlag =
IF(COUNT(BedModelData[PatientMeditechID]) > 'tbl_DaysAbove'[DaysAboveValue], 1, 0)
 
The DaysWhereFlag has 1s or 0s in. The total is always 1 but would like to SUM the 1's.
 
I have tried so many different ways, looked at many websites but just cannot get it to work. Any help will be greatly appreciated.
 
8 REPLIES 8
Anonymous
Not applicable

@davidsimm10 

You can just sum the flag measure, try:

 

measure = Sumx(All(table), DaysWhereFlags)  

or 

measure = Sumx(table,DaysWhereFlags)

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @davidsimm10 


now use the formula; 
Calculate(Sum(DaysWhereFlags),Filter(TableName, (BedModelData[PatientMeditechID]) > ('tbl_DaysAbove'[DaysAboveValue]))

Thats the same answer you said last time so no, it still doesnt work im afraid

Anonymous
Not applicable

Hi 

Have you tried:

Calculate(Sum(DaysWhereFlags),Filter(TableName, (BedModelData[PatientMeditechID]) > ('tbl_DaysAbove'[DaysAboveValue]))

Thank you for the replies. The 'DaysWhereFlag' is a measure so it wont allow it to be put into the dax aboveScreenshot 2020-12-16 180018.png.

Anonymous
Not applicable

Hi,

What i found here is you giving flag value in measure instead of generating the measure, Generate the same value in the Calculated column and then try same formula.

I hope this will help you.

Thanks.
Gaurav Jangra

Thank you. When I turn it into a column, it just needs to say 1/0 or true/false for the DaysWhereFlagCol. If I click 'Dont summarise', it returns all '1's'. I need to find which days are above the 'Days where what if' parameter and then sum the number of days that this happens.

Screenshot 2020-12-17 143834.png

 

vanessafvg
Community Champion
Community Champion

are you able to provide some sampel data or your pbix?

 

please also demonstrate an example of what you want to see.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.