Forum Discussion

sportive92003's avatar
sportive92003
Icon for Helper II rankHelper II
2 years ago
Solved

Easy to fix! DAX formula

Hello,

the goal is to add 157$ (sector division=2 or Clients.secteur=20%...) in sector 01, 02 and 03. For the rest, let the normal amount and eliminate Clients.secteur=20%. The result should be for Clients.secteur= 01-Machine... : 293 290$ (293 132 + 147=293 290); for Clients.secteur= 02 - Marine... :  39 585$ and for Clients.secteur= 03 - Hydro... = 148 838$. The others Clients.secteur stay the same and the goal is eliminate Clients.secteur= 20%... it's why it's divided by 3 (471,5 / 3 = 157$)

 

 

Thanks!

  • Brightsider's avatar
    Brightsider
    2 years ago

    Ah, right. Try this: 

    TEST secteur 5 = IF(
    Fusionner1[Division] = 1,
        [Montant Measure] +
        DIVIDE(
           SUMX(
                FILTER(REMOVEFILTERS(Fusionner1, [Clients.Secteur]), Fusionner1[Clients.Secteur ] = "20% MARINE, 20% HYDRO - 20% MACHINE - 40% PIPELINES"),
                [Montant secteur]),
          3),
         [Montant Measure])

12 Replies

  • Assuming I'm understanding the assignment properly:

    IF([Clients.secteur] in {"1", "2", "3"}, [Somme de test secteur] + 157,
    [Somme de test secteur])

     

    You might need to play with the column/measure references to fit your semantic model.

    • sportive92003's avatar
      sportive92003
      Icon for Helper II rankHelper II

      Thank you Brightsider,

       

      it's not perfect, because + 157 is for month 10. If I put months 1-10 for example, I will have to add 42 890$, not 157$. 

       

       

      Other proposition?

      • Brightsider's avatar
        Brightsider
        Icon for Resolver I rankResolver I

        Ah. Is the amount you need to add fixed per month (i.e. will month 10 always be 157, month 9 always be XYZ, etc)? 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sportive92003 

    Has your problem been solved? If so, please mark the corresponding answer as a solution. If not, please provide sample data that fully covers your issue(in the form of pbix file or table) and the expected outcome based on the sample data you provided.

     

     

     

     

     

    Best Regards,

    Jayleny

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.