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

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

Reply
DIACHROMA
Helper II
Helper II

Capped target in DAX

Hello Dax Lovers, 

I need some help 😊

 

I would like to calculate a rate of progress in relation to an objective, but this rate must be capped at 100%.

 

Example of what I currently have:

NameGoalAchievedRemainingAchievement
A8086-6108%
B4036490%
C5052-2104%
D2018290%

 

Here is what I would like:

 

NameGoalAchievedRemainingAchievement
A80860100%
B4036490%
C50520100%
D2018290%

 

I tried the below formula : 

 

% Achievement =
VAR Numerator = IF( [Achieved] > [Goal]  ;
[Goal]  ;
[Achieved] )

VAR Denominator = [Goal]

RETURN

DIVIDE( Numerator ; Denominator ; 0 )

 

But when I put the measure in a table or matrix, it loads endlessly... (I also tried without variables). 

 

Do you have any idea of what's wrong ? All of my other measures are really fast so I don't think it is a model issue. 

 

In addition, to calculate the "Remaining" I'd like to have 0 if the achieved is greater than the goal but using "if is greater than ... then ..." either I lose my total, or the measure is very long when loading.

 

Many thanks in advance for your help !

 

Pauline

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

 

// If such measures do not work blazingly fast,
// then you have a problem in your model. 100%.

[Capped Achievement] = MIN( 1, DIVIDE( [Achieved], [Goal] ) )

[Surplus] = MAX( 0, [Achieved] - [Goal] )

 

View solution in original post

6 REPLIES 6
daxer-almighty
Solution Sage
Solution Sage

 

// If such measures do not work blazingly fast,
// then you have a problem in your model. 100%.

[Capped Achievement] = MIN( 1, DIVIDE( [Achieved], [Goal] ) )

[Surplus] = MAX( 0, [Achieved] - [Goal] )

 

@daxer-almighty can you explain to me what the cap achievement measure is doing? I just tried it for my need and its working.

Hi @daxer-almighty , it works perfectly and it's super fast!

 

THAAAANKS !!!!

Pauline

Anonymous
Not applicable

Can you try:

Assuming Acheived and Goal are measures. If not then create them as Measures with SUM function.

 

% Achievement =
IF( [Achieved] > [Goal]  ;
100  ;
DIVIDE( Achieved; Goal; 0 ))

 

Remaining =
IF( [Achieved] > [Goal]  ;
0;
Achieved - Goal )

 

 
Anonymous
Not applicable

A correction:

 

Add a new calculated column for Acheivement

NewAcheived = IF(table[Acheived] > table[Goal], table[Goal], table[Ach])
 

then use this calculated column instead of original column as below:

 
Remaining = sum(table[Goal]) - SUM(table[NewAch])
 
Acheive Rate = DIVIDE(SUM(table[NewAch]), sum(table[Goal]))

 

No need for IF else.

 

Greg_Deckler
Community Champion
Community Champion

@DIACHROMA Very strange in terms of you having a performance issue with that measure. However, perhaps simply take the approach of taking what you currently have and adding an IF statement. IF %achievement > 1, 1, %achievement. Assuming you have that in a VAR.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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