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
Anonymous
Not applicable

Create custom column to create cumulative histogram

I am looking for support in carrying out the following:

 

1. There is a table with a column that has Revenue plan numbers and details like country, service, etc. BUT no date

2. I would like to create a custom column that will help me calculate the revenue plan numbers in each row in a way that I have the cumulative numbers for each month. For example: If the total revenue plan is 10,000. January will be 10000/12, February will be (10,000/12)*2, March will be ((10000/12)*2)+ (10000/12) and so on until by December it adds up to the Total revenue plan amount of 10,000.

 

Unable to figure out a way to do this. Some help will be really appreciated.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

For your requirement, you could create a calendar table firstly.

 

Calendar = CALENDAR(DATE(2019,1,1),DATE(2019,12,31))

Then create the measure with SWITCH function to calculate the revenue for each month. You could refer to my expression like below. [SUM ] is also a measure.

 

 

SUM = CALCULATE(SUM('Table'[Revenue]))
reve = VAR a = [SUM] / 12 RETURN SWITCH ( TRUE (), MAX ( 'Calendar'[Date].[Month] ) = "January", a, MAX ( 'Calendar'[Date].[Month] ) = "February", a * 2, MAX ( 'Calendar'[Date].[Month] ) = "March", a * 2 + a,
....,
MAX ( 'Calendar'[Date].[Month] ) = "December", [your expression], Blank() )

Here is my test example, I only calculate for three month.

Untitled.png

 

Hope this can help you.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
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-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

To be more helpful, please share some data sample which could reproduce your scenario and your desired output so that we could copy and test on it.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-piga-msft ,

 

I have created a sample data and visualization for you in excel. The formulas that I used to calculate the cumulative in excel are:

Jan = Total revenue plan / 12 i.e. 280,000/12 = 233,333

Feb = 233,333*2

Mar = 466,667 + 233,333

Apr = 700,000 + 233,333 , and so on

 

I need to create the same thing on Power BI. Hope the sample helps.

 

Data sampleData sampleVisualization sampleVisualization sample

Hi @Anonymous ,

For your requirement, you could create a calendar table firstly.

 

Calendar = CALENDAR(DATE(2019,1,1),DATE(2019,12,31))

Then create the measure with SWITCH function to calculate the revenue for each month. You could refer to my expression like below. [SUM ] is also a measure.

 

 

SUM = CALCULATE(SUM('Table'[Revenue]))
reve = VAR a = [SUM] / 12 RETURN SWITCH ( TRUE (), MAX ( 'Calendar'[Date].[Month] ) = "January", a, MAX ( 'Calendar'[Date].[Month] ) = "February", a * 2, MAX ( 'Calendar'[Date].[Month] ) = "March", a * 2 + a,
....,
MAX ( 'Calendar'[Date].[Month] ) = "December", [your expression], Blank() )

Here is my test example, I only calculate for three month.

Untitled.png

 

Hope this can help you.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
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.