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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

last period value not calculating correctly when rolled-up

Hi all,


In the table below i have the total closed volume by day, and the volume Mvmt is the difference in volume compared to the previouse day.

bokchoyy_4-1690290370187.png

 

it works fine on a daily level, however when rolled up into a weekly level the result is wrong. for exmaple i expect the difference between the weeks starting on 20/07/2023 and 13/07/2023 to be -11143.

how can i write my [Volume mvmt] measure in a way that would allow produce the correct result when rolled up.

Thanks

 



1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I modify the measure of Volume Mvmt, the function is showed below: 

Volume Mvmt = 
IF(
    ISINSCOPE('Table'[Date]) = TRUE(),
    SUM('Table'[Closed Volume]) - CALCULATE(SUM('Table'[Closed Volume]),FILTER(ALLSELECTED('Table'),[Date]=MAX([Date])-1)),
    IF(
        ISINSCOPE('Table'[WeekStartThursday]) = TRUE(),
        CALCULATE(SUM('Table'[Closed Volume]),FILTER(ALLSELECTED('Table'),[WeekStartThursday]=MAX('Table'[WeekStartThursday])+7)) - SUM('Table'[Closed Volume])
    )
)

Description of the code:
            The two if statements help us to distinguish two different levels of the table.

            ISINSCOPE('Table'[Date]) = TRUE() and  ISINSCOPE('Table'[WeekStartThursday]) = TRUE() each is a Boolean function identifies date or week layer.

            Calculate function gives us the final result.

 

Here is the outcome:9.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

I modify the measure of Volume Mvmt, the function is showed below: 

Volume Mvmt = 
IF(
    ISINSCOPE('Table'[Date]) = TRUE(),
    SUM('Table'[Closed Volume]) - CALCULATE(SUM('Table'[Closed Volume]),FILTER(ALLSELECTED('Table'),[Date]=MAX([Date])-1)),
    IF(
        ISINSCOPE('Table'[WeekStartThursday]) = TRUE(),
        CALCULATE(SUM('Table'[Closed Volume]),FILTER(ALLSELECTED('Table'),[WeekStartThursday]=MAX('Table'[WeekStartThursday])+7)) - SUM('Table'[Closed Volume])
    )
)

Description of the code:
            The two if statements help us to distinguish two different levels of the table.

            ISINSCOPE('Table'[Date]) = TRUE() and  ISINSCOPE('Table'[WeekStartThursday]) = TRUE() each is a Boolean function identifies date or week layer.

            Calculate function gives us the final result.

 

Here is the outcome:9.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

Thank you Stephen, the ISINSCOPE fucntion was exactly what i needed.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.