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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Kote101
Helper II
Helper II

Count Rows based on a Variable Value

Hi guys, i am trying to make a measure that will count the number of rows which come up as negative depending on a variable.

The variable i am using to determine which rows i would like to count is basically the percentage difference between the present value and the value before it.

 

So in my measure  (see picture below ) i was expecting a calculation of 1 to come up, because the 1990 row, has a lower value than the 1985 row therefore would come up as a negative in my percentage difference variable. But this doesnt seem to be working, not only this , but my percentage difference variable also seems to be faulty though am not sure why.

 

Measure = 

VAR previousValue= CALCULATE(SUM('Table 2'[Value]),FILTER('Table 2',COUNTROWS(FILTER('Table 2','Table 2'[Year]=EARLIER('Table 2'[Year])))))
var percentageDifference=DIVIDE(SUM('Table 2'[Value])-previousValue,previousValue)*100
return
COUNTROWS(FILTER('Table 2',SIGN(percentageDifference)=-1))

Here is a link to my pbix and CVS file : https://filebin.net/qlgusdv2f3w0pfm4

I hope i was clear enough, thank you for your time and help!

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Kote101,

 

Would you please re-upload your sample .pbix file, as I didn't find it in the downloaded zip file?

 

Regards,

Yuliana Gu

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

hi @v-yulgu-msft it seems u may have opened the pbix file using a zip file program, try opening it with pbix; as the demo 1 file is a pbix file not a zip file.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.