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
JaclynPugh2022
Helper II
Helper II

Subtotals are incorrect on variable that provides actual and forecast based on received date.

The total quantity is incorrect.  How can I fix this please?

JaclynPugh2022_0-1657302465088.png

 

Rolling Avg MTD Qty 3 Mo =
VAR LastReceivedDate =
CALCULATE( MAX('received pivot'[Date]),
REMOVEFILTERS()
)
VAR Actuals = [MTD Qty in ths side tbl]
VAR FutureForecast =
CALCULATE(
    [Quantity Forecast],
    KEEPFILTERS('DimDate1'[Date]>LastReceivedDate)
)
VAR Result = FutureForecast + Actuals
RETURN
Result
1 ACCEPTED SOLUTION

Hi @JaclynPugh2022 ,

 

I am not sure if I understood your question correctly. Do you want to calculate only the rows with values greater than 0 in the subtotal?

 

Measure = 
IF (
    ISFILTERED ( Forecast[sublevel items] ),
    SUM ( Forecast[Value] ),
    CALCULATE (
        SUM ( Forecast[Value] ),
        FILTER (
            SUMMARIZE (
                Forecast,
                Forecast[Item],
                Forecast[sublevel items],
                'Calendar'[Date].[Month],
                "_sum", SUM ( Forecast[Value] )
            ),
            [_sum] >= 0
        )
    )
)

vkkfmsft_0-1657875384790.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @JaclynPugh2022 ,

 

Please try the measure.

 

Measure = 
IF ( 
    ISFILTERED ( 'Table'[MMM_YYYY] ),
    [Rolling Avg MTD Qty 3 Mo], 
    SUMX ( VALUES ( 'Table'[MMM_YYYY] ), [Rolling Avg MTD Qty 3 Mo] )
)

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I like how this works, it adds up correctly; however, I still need to get the sublevel items so the part nubmers that roll up into this total to sum correctly.  The part numbers do not sum up to the month total as shown below, for example, looking at Second Item, for July if I sum the totals of the below parts I get (104), but that is not right because the overall month total is correct (24).  Any ides?

JaclynPugh2022_0-1657805855863.png

 

Hi @JaclynPugh2022 ,

 

I am not sure if I understood your question correctly. Do you want to calculate only the rows with values greater than 0 in the subtotal?

 

Measure = 
IF (
    ISFILTERED ( Forecast[sublevel items] ),
    SUM ( Forecast[Value] ),
    CALCULATE (
        SUM ( Forecast[Value] ),
        FILTER (
            SUMMARIZE (
                Forecast,
                Forecast[Item],
                Forecast[sublevel items],
                'Calendar'[Date].[Month],
                "_sum", SUM ( Forecast[Value] )
            ),
            [_sum] >= 0
        )
    )
)

vkkfmsft_0-1657875384790.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.