Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago

Effectivizar dax

Good day, I need your help to be able to make effective a Dax which is ceasing to be effective because each time they are adding more IF, due to the variation of rates that are happening lately in the banks I have to make a recalculation depending on the day of update.

For each rate update I am creating a new table with the new rates and making a concord of queries to put the new values in each type of quota, this leads to many new columns being added to the base, would there be any way to do it with variables the recalculation?, attached example of DAX of current calculation.

CAPITAL-RECALCULATION-LOAN =
IF(SANTANDER_CREDITOSORIGINADOS[ClosesHigh] < DATE(2024,3,13),
ROUND(SANTANDER_CREDITOSORIGINADOS[CapitalOrder]/SANTANDER_CREDITOSORIGINADOS[TASAS01022024_INVERSO],-2),
IF(SANTANDER_CREDITOSORIGINADOS[ClosesHigh] < DATE(2024,5,6),
ROUND(SANTANDER_CREDITOSORIGINADOS[CapitalOrder]/SANTANDER_CREDITOSORIGINADOS[TASAS13032024_INVERSO],-2),
IF(SANTANDER_CREDITOSORIGINADOS[ClosesHigh] < DATE(2024,5,14),
ROUND(SANTANDER_CREDITOSORIGINADOS[CapitalOrder]/SANTANDER_CREDITOSORIGINADOS[TASAS06052024_INVERSO],-2),
IF(SANTANDER_CREDITOSORIGINADOS[ClosesHigh] < DATE(2024,5,22),
ROUND(SANTANDER_CREDITOSORIGINADOS[CapitalOrder]/SANTANDER_CREDITOSORIGINADOS[TASAS14052024. INVERSE],-2),
ROUND(SANTANDER_CREDITOSORIGINADOS[CapitalOrder]/SANTANDER_CREDITOSORIGINADOS[TASAS22052024. INVERSE],-2)))))
and attached sample tables
TASAS22052024

Term

Inverse
122,273714372
152,364325044
182,486005891
212,601584784
242,631063657
302,701546963
362,786905596
482,890684246

TASAS06052024

Term capital
122,21432009
152,29367352
182,40365958
212,5085204
242,53135701
302,59101484
362,66540402
482,75483515

CREDIT TABLE

cant_cuotas capital
12 $ 1.000.000,00
15 $ 151.550,00
18 $ 151.881,00
21 $ 1.100.000,00
24 $ 141.848,00
30 $ 1.515.888,00
36 $ 11.588,00
48 $ 1.588.448,00

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

     

    To create a table containing each rate and its effective date, try the following expression. If the problem persists.Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

     

    Capital Recalculation Loan = 
    VAR UpdateDate = MAX(SANTANDER_CREDITOSORIGINADOS[ClosesHigh])
    VAR ApplicableRate = 
        LOOKUPVALUE(
            Rates[InverseRate], 
            Rates[RateDate], 
            CALCULATE(
                MAX(Rates[RateDate]), 
                FILTER(
                    Rates, 
                    Rates[RateDate] <= UpdateDate
                )
            )
        )
    RETURN
    ROUND(
        SANTANDER_CREDITOSORIGINADOS[CapitalOrder] / ApplicableRate,
        -2
    )
    

     

    Best Regards,

    Clara Gong

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

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      Good afternoon, thank you very much for your answer, I have the .pbix file set up and ready to attach but it does not allow me to attach it, could you provide me with the option that allows me to attach it.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Syndicate_Admin ,

         

        You can sign out of your account in power bi desktop and then save the pbix file and upload it.


        You can also change the sensitivity of the file to public and then try to upload it.

         

        Best Regards,

        Clara Gong

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

  • Good afternoon, thank you very much for answering my question, but the system does not allow you to upload .pbix files, attached screenshot of the error, I don't know if I have to have a special permission or I am doing something wrongly, I would appreciate your answer.

    Thank you very much in advance.