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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
CEllis
Resolver I
Resolver I

Measure not counting

Afternoon,

 

I have 2 measures that calculate if one is above or below the other.

I can get this far but for some reason it wont total the 'Movement (Up)' or Movement(Down) measures and the 'Movement (Up)' is counting all rows not just the ones that match the criteria.

 

 

Movement (Down) = 

Var _Current = CALCULATE(Average('Table1'[Result]),FILTER('Table1','Table1'[Collection]="Current"))
Var _Previous = CALCULATE(Average('Table1'[Result]),REMOVEFILTERS('Table1'[Collection]),'Table1'[Collection]=("Previouse"))

RETURN
CONVERT(CALCULATE(COUNTA('Table1'[Anon]),FILTER('Table1',_Current>_Previous)),INTEGER)

 

 

CEllis_0-1718276097285.png

 

Example data

Table1 

AnonResultCollection
Pupil 328128Current
Pupil 345660Current
Pupil 350828Current
Pupil 350926Current
Pupil 359239Current
Pupil 360650Current
Pupil 362828Current
Pupil 363513Current
Pupil 367169Current
Pupil 375354Current
Pupil 381564Current
Pupil 382735Current
Pupil 382858Current
Pupil 3881-27Current
Pupil 391254Current
Pupil 391826Current
Pupil 3954-93Current
Pupil 396972Current
Pupil 399820Current
Pupil 4031-42Current
Pupil 411467Current
Pupil 433827Current
Pupil 436933Current
Pupil 446283Current
Pupil 3309-3Current
Pupil 3330-46Current
Pupil 37253Current
Pupil 4236 Current
Pupil 445034Current
Pupil 446410Current
Pupil 3281-1Previouse
Pupil 345643Previouse
Pupil 350823Previouse
Pupil 3509-5Previouse
Pupil 359229Previouse
Pupil 360636Previouse
Pupil 362813Previouse
Pupil 3635-11Previouse
Pupil 367128Previouse
Pupil 375316Previouse
Pupil 381561Previouse
Pupil 382734Previouse
Pupil 382822Previouse
Pupil 3881-46Previouse
Pupil 391248Previouse
Pupil 3918-2Previouse
Pupil 3954-105Previouse
Pupil 396954Previouse
Pupil 39986Previouse
Pupil 4031-65Previouse
Pupil 411442Previouse
Pupil 433816Previouse
Pupil 4369-44Previouse
Pupil 446272Previouse
Pupil 33093Previouse
Pupil 3330-36Previouse
Pupil 372537Previouse
Pupil 423657Previouse
Pupil 445037Previouse
Pupil 446434Previouse

 

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @CEllis ,

I create a table as you mentioned.

vyilongmsft_0-1718332358195.png

Maybe I think you can use this calculated column, here is the DAX code.

Column = IF('Table'[Current]>'Table'[Previous],"Current","Previous")

vyilongmsft_1-1718332466055.png

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @CEllis ,

I create a table as you mentioned.

vyilongmsft_0-1718332358195.png

Maybe I think you can use this calculated column, here is the DAX code.

Column = IF('Table'[Current]>'Table'[Previous],"Current","Previous")

vyilongmsft_1-1718332466055.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

 

 

 

Greg_Deckler
Super User
Super User

@CEllis First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

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

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors