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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SteveMBSDO
Helper I
Helper I

COUNTIFS with Multiple Statements referring to Current Row value

For each row, I want to get a unique following number per Focus Tank. In Excel I accomplisted this by a COUNTIFS statement:

 

COUNTIFS if:

Column [Focus Tank] matches the [Focus Tank] value of the current row.

Column [NewStart] is less than or equal to the [NewStart] value of the current row.

Works a charm.

 

SteveMBSDO_0-1702992446346.png

 

In PowerBI I came up with this, but it is not functioning because I don't know how to make code "VALUE(45907.74585)" dynamic. Meaning, this value should get the value from it's current ROW, and not be hardcoded. Anyone know what I'm missing here?

SteveMBSDO_1-1702992652859.png

 

Thanks!

 

1 ACCEPTED SOLUTION

Hi, @SteveMBSDO 

transaction =
var a = 'transaction database'[datetime chrono]
return
countx( 
filter('transaction database',
'transaction database'[focus tank]=30 &&
'transaction database'[datetime chrono]< a
),
'transaction database'[datetime chrono]
)

View solution in original post

4 REPLIES 4
Dangar332
Super User
Super User

HI, @SteveMBSDO 

if it is measure then try below
measure =
var a = max(tablename[column name from value coming])


and compare it like (<a instead of  values(...))

 

code like
measure =
var a = max(tablename[column name from value coming])

return

countx(

..........,

.....[datetime chrono]<a

)

 

if its column then 
var a = tablename[column name from value coming]

Hi @Dangar332 , sorry I forgot to mention it's a table.

 

SteveMBSDO_0-1702994811908.png

 

Hi, @SteveMBSDO 

transaction =
var a = 'transaction database'[datetime chrono]
return
countx( 
filter('transaction database',
'transaction database'[focus tank]=30 &&
'transaction database'[datetime chrono]< a
),
'transaction database'[datetime chrono]
)

Hi, @Dangar332  Awesome! Thank you. I've also added the dynamic focus tank to the list of variables:

SteveMBSDO_0-1702996254799.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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