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
Ito_c
Frequent Visitor

Cumulative return wrong over another measure (I do not have date column)

I'm trying to return cumulative percentile by fiscal week inside a fiscal quarter. But my dataset is aggregated and I dont have the transaction data.

 

This is my original dataset:

Fiscal YearFiscal QuarterFiscal MonthFiscal Week Value 
FY2022FQ02FM04FW16 $        27,172.31
FY2022FQ02FM04FW17 $          2,491.00
FY2022FQ02FM05FW19 $      174,742.22
FY2022FQ02FM05FW20 $        44,876.06
FY2022FQ02FM05FW21 $        78,279.50
FY2022FQ02FM06FW22 $        22,681.33

 

I created three measures to return the Total of value, the count of fiscal week and get the percentile based on the sum of total value divided by count of fiscal week and this result divided by Total value.

 

Spoiler
Total Value = calculate(sum('Table'[ Value ]), allselected('Table'))
 
Spoiler
Fiscal Week count = calculate(distinctcount('Table'[Fiscal Week]),allselected('Table'))
 
Spoiler
Percentile by Fiscal Week = calculate(divide(divide([Total Value],[Fiscal Week count],0),[Total Value],0))
 
Now I have:
Fiscal YearFiscal QuarterFiscal MonthFiscal Week Value Total ValueFiscal Week countPercentile by Fiscal Week
FY2022FQ02FM04FW16 $        27,172.31 $  350,242.42616.67%
FY2022FQ02FM04FW17 $          2,491.00 $  350,242.42616.67%
FY2022FQ02FM05FW19 $      174,742.22 $  350,242.42616.67%
FY2022FQ02FM05FW20 $        44,876.06 $  350,242.42616.67%
FY2022FQ02FM05FW21 $        78,279.50 $  350,242.42616.67%
FY2022FQ02FM06FW22 $        22,681.33 $  350,242.42616.67%
 
 So, when I try to calculate the cumulative for Percentile by Fiscal Week, the result not match as cumulative disered column. Do you know how to proper calculate the cumulative in this case?
 
Fiscal YearFiscal QuarterFiscal MonthFiscal Week Value Total ValueFiscal Week countPercentile by Fiscal WeekCumulative Desired
FY2022FQ02FM04FW16 $        27,172.31 $  350,242.42616.67%16.67%
FY2022FQ02FM04FW17 $          2,491.00 $  350,242.42616.67%33.34%
FY2022FQ02FM05FW19 $      174,742.22 $  350,242.42616.67%50.01%
FY2022FQ02FM05FW20 $        44,876.06 $  350,242.42616.67%66.68%
FY2022FQ02FM05FW21 $        78,279.50 $  350,242.42616.67%83.35%
FY2022FQ02FM06FW22 $        22,681.33 $  350,242.42616.67%100.00%
 

 

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Ito_c ,

 

According to your description, it is recommended to create a calculated column for cumulative statistics.

Refer to a formula similar to the following.

Sum_M = sum(FactInternetSales[SalesAmount])
cal_sum = [Sum]

cal_dy = 
VAR currentTotalSales = DimProduct[cal_sum]
RETURN
    SUMX (
        FILTER ( DimProduct, DimProduct[cal_sum] > currentTotalSales ),
        DimProduct[cal_sum]
    )

cal_account = 
DIVIDE ( DimProduct[cal_dy], SUM ( DimProduct[cal_sum] ), BLANK () )

vhenrykmstf_0-1657872018448.png

 

If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @Ito_c ,

 

According to your description, it is recommended to create a calculated column for cumulative statistics.

Refer to a formula similar to the following.

Sum_M = sum(FactInternetSales[SalesAmount])
cal_sum = [Sum]

cal_dy = 
VAR currentTotalSales = DimProduct[cal_sum]
RETURN
    SUMX (
        FILTER ( DimProduct, DimProduct[cal_sum] > currentTotalSales ),
        DimProduct[cal_sum]
    )

cal_account = 
DIVIDE ( DimProduct[cal_dy], SUM ( DimProduct[cal_sum] ), BLANK () )

vhenrykmstf_0-1657872018448.png

 

If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


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.