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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Accrued by identifier and reset the account by month

I need to accumulate "Hours" from the Detail table and reset by months.

I've created the month column based on the date and sorted by Date from lowest to highest

Mes = MONTH([Fecha])

I have used the following measure:

Acumulado = 
CALCULATE(
	SUM('Detalle'[Horas]),
	FILTER(
		ALLSELECTED('Detalle'[identificador]),
		ISONORAFTER('Detalle'[identificador], MAX('Detalle'[identificador]), DESC)
	)
)

It accumulates well, but I don't know how to indicate that I reset the accumulated when I changed the month.

miquinti_0-1703146194722.png

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

I've solved it as follows:

Acumulado  = 
CALCULATE (
    SUM ( 'Detalle'[Horas] ),
    FILTER (
        ALLSELECTED ( 'Detalle' ),
        'Detalle'[identificador] <= MAX ( 'Detalle'[identificador] )
             && 'Detalle'[Mes] = MAX ( 'Detalle'[Mes]
    )
))

View solution in original post

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

I've solved it as follows:

Acumulado  = 
CALCULATE (
    SUM ( 'Detalle'[Horas] ),
    FILTER (
        ALLSELECTED ( 'Detalle' ),
        'Detalle'[identificador] <= MAX ( 'Detalle'[identificador] )
             && 'Detalle'[Mes] = MAX ( 'Detalle'[Mes]
    )
))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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