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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
EdgarEstrella
Frequent Visitor

Como restar valores acomulados por fecha??

Hola a todos, 

 

tengo un problema intentando generar una medida, tengo una tabla con registros de consumo energetico (acumulado), son varias mediciones por dia, si quisiera saber el consumo total del día solo tendria que restar el ultimo registro y el primero del mismo dia

 

Espero haber sido suficientemente claro y agradezco de antemano el apoyo

 

fechaAcumulado al momento

consumo(esta es la medida que no logro generar)

01/11/2019 0:05:001,725.91 
01/11/2019 0:10:001,725.94

R=0.03 (1,725.94-1,725.91)

01/11/2019 0:15:001,725.970.03
01/11/2019 0:20:001,726.000.03
01/11/2019 0:25:001,726.030.03
01/11/2019 0:30:001,726.060.03
01/11/2019 0:35:001,726.090.03
01/11/2019 0:40:001,726.110.02
01/11/2019 0:45:001,726.160.05
01/11/2019 0:50:001,726.190.03
01/11/2019 0:55:001,726.220.03
01/11/2019 1:00:001,726.260.04
01/11/2019 1:05:001,726.300.04
01/11/2019 1:10:001,726.320.02
01/11/2019 1:15:001,726.360.04
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @EdgarEstrella ,

 

If I understand you correctly, please check following measure and see if the result achieve your expectation:

Measure 2 = 
VAR a =
    CALCULATE (
        MAX ( 'Table'[fecha] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            FORMAT ( 'Table'[fecha], "YYYYMMDD" )
                = FORMAT ( MAX ( 'Table'[fecha] ), "YYYYMMDD" )
        )
    )
VAR b =
    CALCULATE (
        MIN ( 'Table'[fecha] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            FORMAT ( 'Table'[fecha], "YYYYMMDD" )
                = FORMAT ( MAX ( 'Table'[fecha] ), "YYYYMMDD" )
        )
    )
VAR c =
    CALCULATE (
        MAX ( 'Table'[Acumulado al momento] ),
        FILTER ( ALL ( 'Table' ), 'Table'[fecha] = a )
    )
VAR d =
    CALCULATE (
        MAX ( 'Table'[Acumulado al momento] ),
        FILTER ( ALL ( 'Table' ), 'Table'[fecha] = b )
    )
RETURN
    c - d

Result would be shown as below:

1.PNG

If I misunderstood your meaning, please let me know.
BTW, Pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @EdgarEstrella ,

 

If I understand you correctly, please check following measure and see if the result achieve your expectation:

Measure 2 = 
VAR a =
    CALCULATE (
        MAX ( 'Table'[fecha] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            FORMAT ( 'Table'[fecha], "YYYYMMDD" )
                = FORMAT ( MAX ( 'Table'[fecha] ), "YYYYMMDD" )
        )
    )
VAR b =
    CALCULATE (
        MIN ( 'Table'[fecha] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            FORMAT ( 'Table'[fecha], "YYYYMMDD" )
                = FORMAT ( MAX ( 'Table'[fecha] ), "YYYYMMDD" )
        )
    )
VAR c =
    CALCULATE (
        MAX ( 'Table'[Acumulado al momento] ),
        FILTER ( ALL ( 'Table' ), 'Table'[fecha] = a )
    )
VAR d =
    CALCULATE (
        MAX ( 'Table'[Acumulado al momento] ),
        FILTER ( ALL ( 'Table' ), 'Table'[fecha] = b )
    )
RETURN
    c - d

Result would be shown as below:

1.PNG

If I misunderstood your meaning, please let me know.
BTW, Pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Hello I am trying to to the same operation but it does not works, for example I need to display current value- previous value like the picture that I send you, what is wrong?

 

MARLONHN_0-1667589031105.png

 

Anonymous
Not applicable

Buenos días, queria consultar sobre la solución de este tema, ya que estoy trabajando con un problema similar.

Te agardezco si puedes resubir el .PBIX para poder resolver este problema.

thank so much v-jayw-msft , you,re a master

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.