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
Gdibbs
Helper I
Helper I

Cumulating percent development year over year

Hello,

 

I am really stuck and need some guidance.  

 

I have 5 years worth of sales data which I have converted to a % of total sales over the selected period.  I have also built a measure that allows me to cumulate these percentages to 100% over the selected period of time.

 

What I cannot figure out is the following:  I want to be able to look at the cumulative % development for each year (from Jan-Dec) on the same line chart - using DAX..  I can look at one year at a time, but if I select all the years they stack to cumulatively get me to 100%.  I need to see them discretly built to 100%. 

 

How I get the percentage of volume to total volume per month:

% Volume Total = divide (SUM(Greg_SCOPS_Excellence[Base Quantity (SKU)]), CALCULATE(sum(Greg_SCOPS_Excellence[Base Quantity (SKU)]), ALLSELECTED()))
 
How I cumulate:  
Cumu Volume % = (divide([Cumu Volume Count], CALCULATE([Cumu Volume Count], ALLSELECTED(Greg_SCOPS_Excellence)), blank()))
 
How I attempted (this one of a few different attempts) to cumulate year by year:
GJD Cumu Development YoY = CALCULATE(divide([Cumu Volume Count], CALCULATE([Cumu Volume Count], FILTER(ALLSELECTED(Greg_SCOPS_Excellence), Greg_SCOPS_Excellence[Calendar Day].[Year] <= MAX(Greg_SCOPS_Excellence[Calendar Day].[Year])))))
 
What I get:
Gdibbs_0-1628015009265.png

 

Above is wrong (last column) because if I just select 2017 I get this result, which is correct.

Gdibbs_1-1628015095885.png

 

I am new to Power BI and am learning, so any help and explanation as to how to approach this would be greatly appreciated.

1 ACCEPTED SOLUTION
Mohammad_Refaei
Solution Specialist
Solution Specialist

In this example you should use simple time intelligence functionalities.

I would calculate the measure using the DATESYTD and then it should relflect the correct figures.

Assuming that you have a calendar table, you can use this measure:

 

Volume YTD% =
DIVIDE (
    CALCULATE (
        SUM ( Greg_SCOPS_Excellence[Base Quantity (SKU)] ),
        DATESYTD ( 'Calendar'[Date] )
    ),
    CALCULATE (
        SUM ( Greg_SCOPS_Excellence[Base Quantity (SKU)] ),
        ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )
    )
)

 

View solution in original post

1 REPLY 1
Mohammad_Refaei
Solution Specialist
Solution Specialist

In this example you should use simple time intelligence functionalities.

I would calculate the measure using the DATESYTD and then it should relflect the correct figures.

Assuming that you have a calendar table, you can use this measure:

 

Volume YTD% =
DIVIDE (
    CALCULATE (
        SUM ( Greg_SCOPS_Excellence[Base Quantity (SKU)] ),
        DATESYTD ( 'Calendar'[Date] )
    ),
    CALCULATE (
        SUM ( Greg_SCOPS_Excellence[Base Quantity (SKU)] ),
        ALLEXCEPT ( 'Calendar', 'Calendar'[Year] )
    )
)

 

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.

Top Solution Authors