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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
karimkz
Advocate I
Advocate I

DAX reference to current row value??

Hello!
I can't find a solution for this lilttle problem.
Here is the dataset, it has Units and Performance. I want to make a calculated column with a Maximum Performance for each distinct Unit. (hardcoded here below for example purposes)

quetions.png

Should be smth like this:
maximum = CALCULATE(MAX(table[performance]); table[unit] = ***current unit or what...???***))

Any help is appreciated!

1 ACCEPTED SOLUTION
tringuyenminh92
Memorable Member
Memorable Member

Hi @karimkz,

 

if you are using calculated column:

 

maximum = CALCULATE(MAX(table[performance]),filter(all(table),  table[unit] = earlier(table[unit])  ) ))

(earlier/earliest will return current row in calculated column expression)

View solution in original post

6 REPLIES 6
garythomannCoGC
Impactful Individual
Impactful Individual

 

 

maximum = 
    CALCULATE ( 
        MAX ( table[performance] ),
        FILTER ( 
            ALL (table),  
            table[unit] = EARLIER ( table[unit] )  
        ) 
    )

 

 

Extra bracket removed.  As sqlbi.com says "if its not formatted then its not dax" :}

And thank you for the construct it helped to resolve an issue.

nrichardsonmcs
New Member

SUMX (
FILTER (
'NAV - Job Ledger Entry',
'NAV - Job Ledger Entry'[Job_No] = EARLIER('NAV - Job Ledger Entry'[Job_No])
&& 'NAV - Job Ledger Entry'[AuxiliaryIndex1] <= EARLIER('NAV - Job Ledger Entry'[AuxiliaryIndex1])
&& LEFT ( 'NAV - Job Ledger Entry'[Job_Task_No], 1 ) =Left(EARLIER('NAV - Job Ledger Entry'[Job_Task_No],1)) && 'NAV - Job Ledger Entry'[Type] = "Usage"
),
'NAV - Job Ledger Entry'[Quantity]
)
 
Hello All, 
 
I've tried using the earlier function to try and calculate a running total but end up returning nothing on this. Only returns Blanks. This is trying to calculate the rolling total for each row in the table based on certain criteria (Job No., Left(Job Task No, 1) and AuxilaryIndex 1) any help would be appreciated on this if you can spot where i'm going wrong. 
 
Regards
 
Nate
tringuyenminh92
Memorable Member
Memorable Member

Hi @karimkz,

 

if you are using calculated column:

 

maximum = CALCULATE(MAX(table[performance]),filter(all(table),  table[unit] = earlier(table[unit])  ) ))

(earlier/earliest will return current row in calculated column expression)

What if its a measure? I want the average rate benchmark for any given bid to be calculated across all bids with that same location and job role. The approach of using EARLIER does not work within a measure.

=CALCULATE(AVERAGEX('Bids','Bids'[Hourly Rate]), FILTER(ALL('Projects'), 'Projects'[Location] = 'Projects'[Location] && 'Projects'[Job Role] = 'Projects'[Job Role]))

 

 

 

Spurta
Frequent Visitor

Did you ever figure out how to incorporate this into a Measure? I'm struggling with something similar.

Hopefully you guys figured this out, amazing how difficult to get this simple stuff done in the context of Power Pivot. I really think they should blend the functionalities of Excel and Power Pivot all together. There are things that can be done in 5 seconds in Excel, but would take 5 days to learn to how to get in PP, and vice versa.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors