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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Issue with sumx

Hello all, 

 

I've tried to put this in many ways by my own, but i'm still struggling to solve this problem. Sorry by advance if it seems like a beginer question. I hope somebody knows the answer here. I have a measure calculation rule which is : 

 

Rouge2 = Calculate(
IF(
(QUOTIENT(SUMX('Table2','Table2'[Xp]-'Table2'[prérequis]),12)+1) >= 5,
5,
QUOTIENT(SUMX('Table2','Table2'[Xp]-'Table2'[prérequis]),12)+1)
*SUMX('Table2','Table2'[Weight])),
Codetable2[Couleur]="R")
 
[Xp], [Requis] and [Weight] are Whole number datatype and
Table2(Many to) is linked to Codetable2(1)  
 
My problem is that when I try to display this mesaure by an other text column ' C1' of table2. base
I have right now : 3+3 =6 >=5 --> 5 * (10+5) = 75
I would like to have : 3*10 + 3*5 = 45
 
sumxissue.PNG
 
Do you have the solution ?
 
Thank you
 
 

 

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks  lot for your help,

I found the solution it's : 

 

Rouge2 =
SUMX (
DISTINCT('Lot 2'[Competence]),
CALCULATE (
VAR CC =
SUMX('Lot 2','Lot 2'[XP]-'Lot 2'[Prérequis])
VAR AA =
IF ( CC <0,0,QUOTIENT(CC, 12) + 1)
VAR BB =
IF ( AA >= 5,5*SUMx ('Lot 2','Lot 2'[Weight]), AA * SUMX ( 'Lot 2','Lot 2'[Weight]) )
RETURN
BB,
Codelot2[Couleur]= "R"
)
)

View solution in original post

5 REPLIES 5
Thejeswar
Super User
Super User

Hi @Anonymous ,

Can you give some more details on your isse.

 

If possible, can you give a sample data of your tables and an expected result example

Anonymous
Not applicable

Thanks  lot for your help,

I found the solution it's : 

 

Rouge2 =
SUMX (
DISTINCT('Lot 2'[Competence]),
CALCULATE (
VAR CC =
SUMX('Lot 2','Lot 2'[XP]-'Lot 2'[Prérequis])
VAR AA =
IF ( CC <0,0,QUOTIENT(CC, 12) + 1)
VAR BB =
IF ( AA >= 5,5*SUMx ('Lot 2','Lot 2'[Weight]), AA * SUMX ( 'Lot 2','Lot 2'[Weight]) )
RETURN
BB,
Codelot2[Couleur]= "R"
)
)

Great!!
AntrikshSharma
Super User
Super User

Maybe try something like this:

Rouge2 =
SUMX (
    VALUES ( 'Table2'[C1] ),
    CALCULATE (
        VAR AA =
            QUOTIENT ( SUMX ( 'Table2', 'Table2'[Xp] - 'Table2'[prérequis] ), 12 ) + 1
        VAR BB =
            IF ( AA >= 5, 5, AA * SUMX ( 'Table2', 'Table2'[Weight] ) )
        RETURN
            BB,
        Codetable2[Couleur] = "R"
    )
)
Anonymous
Not applicable

Hi Antriksh Sharma, 

 

Thank you for your reply and the tips for writting in dax. 
Unfortunately it's not working because I need in BB var that the 1st condition equal to 5 must be multipied by Table2[Weight] also. 

😕 

However, here is some data sample 

 XpPrérequisWeightPoints(Rouge2)Competencies
Value 1361210(Q(36-12,12)+1)*10=30C1
Value 172125(Q(72-12,12)+1*5 = 25C2
Value 1612100C3

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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