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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jotapece
Helper I
Helper I

Help with interest meassure over time

Hello all.

I have a bad time trying to get that DAX meassure and I need a hand so, I have this data and calcs in excel:

 
 

Screen 1.png

The meassure I want to get is [Interest Total].

[Interest Total] = [Interest1] + [Interest2]

 

[Interest1] =

 

Screen 2.png

(The SI function in IF function in spanish).

 

[Interest2] =

 

Screen 3.png

Note: [Interest2] always SUM all the previous interest (1 and 2). Then affect with correspond rate to get the result.

 

 

[Year - Month]: is column in the calendar table with all the consecutive dates.

[Accumulated Profit], [Active Rate] and [Passive Rate] are a meassures.

 

I could calculate [Interest1] in a meassure (thinking in auxiliar meassure to get the total), but I can't figure out how get [Interest2)].

Any Ideas?

 

Regards,

JP

2 REPLIES 2
jotapece
Helper I
Helper I

I'm struggling with this for days!

I write this meassure in Dax Studio:

EVALUATE
VAR Paso1 =
    FILTER (
        SUMMARIZE (
            Calendario;
            Calendario[idxFecha];
            "R"; CALCULATE ( [Resultado Acumulado] - [Resultado]; Centros_Costo[CC] = "2500" )
        );
        [R] <> BLANK ()
    )
VAR Paso2 =
    ADDCOLUMNS (
        Paso1;
        "IntR"; [R]
            * IF ( [R] >= 0; [Tasa Pasiva]; [Tasa Activa] )
    )
VAR Paso3 =
    ADDCOLUMNS (
        Paso2;
        "Int2";
        VAR Suma =
            SUMX ( FILTER ( Paso2; [idxFecha] < EARLIER ( [idxFecha] ) ); [IntR] )
        RETURN
            Suma
                * IF ( Suma >= 0; [Tasa Pasiva]; [Tasa Activa] )
    )
VAR Paso4 =
    ADDCOLUMNS (
        Paso3;
        "Int3";
        VAR Suma =
            SUMX ( FILTER ( Paso3; [idxFecha] < EARLIER ( [idxFecha] ) ); [Int2] )
        RETURN
            Suma
                * IF ( Suma >= 0; [Tasa Pasiva]; [Tasa Activa] )
    )
VAR Paso5 =
    ADDCOLUMNS ( Paso4; "IntTotal"; [IntR] + [Int2] + [Int3] )
RETURN
    Paso5

 

[IdxFecha] = Year * 100 + Day

This are the results:

 

Anotación 2020-04-06 172549.png

This are correct results for [IntTotal].

 

Now I wat go back to Power BI and....

Anotación 2020-04-06 175951.png

 So, the total is correct, but I lost my data lineage.

 

The meassure [Interes] is all the code at first, but the last line change to SUMX( Paso5; [IntTotal] ). 

 

Any ideas?

 

Thanks!

 

Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors