cancel
Showing results for
Did you mean:
Helper V

## To calculate the total dynamically

Hi,

I am stuck up in calculating a running total for one of my reports.In the image given beloww i would basically liske to adjust the on hand demand like the one shown below.

Presently it is taking the values that are coming from the database and then adding it up.I have used a calculated measure for doing up the cumulative calculation.

Any help would be much appreciated!!

17 REPLIES 17
Super User III

Hi,

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper V

Hi,

My pbix file is having some private data.So is there any way to share it with you by hiding the data that is private?

Super User III

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper V

Hi,

I am unable to attach my pbix file in the message.

So could you please tell me a way to do this?

Super User III

Hi,

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper V

Hi,

Thank you for help.

I have uploaded my file in the location below:

In the file if you will click on B then a screenshot will appear as follows

So now I would like to see the previous week's running total value in the on hand supply part till last week and again calcluate the running total with the newly adjusted values.

Thanks.

Super User III

Hi,

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper V

Hi,

I have updated my test file with some changes in the calculation for running total

I need to change my pbi file as follows:

The cumulative total for a previous week should be assigned to the on hand quantity of next week.

week 47:

On hand = total of week 46 = 557.72

week 48:

On hand = total of week 47 =  -993.83

week 49:

On hand = total of week 48 = -1551.55 +(- 993.83) = -2545.83

and like this in the remaining weeks.

I need to implement this in one of my report very urgently.

Any help will be greatly appreciated!!

Super User III

Hi,

I may be able to solve this in Ecel using the PowerPivot and CUBE functions.  I cannot solve this in PBI desktop.  Sorry but will not be able to help.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Helper V

Thanks for your help and time!!

Helper V

Thank you for the update!!

Were you able to find a solution to this problem with the pbi file shared in one of the trailing posts?

I am very new to Power BI and need to implement it in one of my reports urgently.

Helper V

I have modified my pbi file with some calculations and shared it below:

Now i need to make some changes in the way data is being represented in the file.I need to re-adjust the value of on hand quantity of the current week with the cumulative total of the previous week(demand+inbound supply+on Hand).Presently the on hand field is showing the same value for every week(in this example)

For week 47:

On hand = running total of previous week(46)= 557.72

For week 48:

On hand =  running total of previous week(46)=-993.83 etc.. till the last week.

Adjusting the value of on hand will also change the cumulative total that is being represented for any week.

I need to implement this in one of my reports very urgently as it is hampering the progress of it.

Any help/pointers will be greatly appreciated!!

Please let me know for any question/clarification

Thanks

Community Support

Hi @sajal161292,

I think you can add filter to check where the formula is calculated on and use previous result to replace current value.(your visual contains complex grouping columns, it is hard to write a specific condition to filter on it)

For example:

Modify formula shows total as 0, May,July shows 'custom'.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Helper V

Hi @v-shex-msft,

I have modified my pbi file with adding up a new measure for representing the previous week sales.

Now i am stuck up while re-assigning the value of previous week sales to the field Total.

Is there any way to perform iteration in DAX and traverse for each record?

Community Support

HI @sajal161292,

>>Is there any way to perform iteration in DAX and traverse for each record?

It is possible to achieve this, but you need to add huge amount of conditions to help measures confirm where current content calculated.

In my opinion, power bi not support auto/dynamic calculate on complex measures(exist some specific filters, contains break row contents function e.g. 'all/allexcept').

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Helper V

Hi,

So will it be possible to perform this operation in DAX?

Thanks

Har**bleep**a Singh

Community Support

Hi @sajal161292,

Please share the sample pbix file to test, it will be help to analysis your situation.(if your file contains some privacy data, you only need to share part of them or use original structure to create some fake data)

BTW, measures which works on specific filters normally not work properly on total row. In my opinion, you need to add a filter to check on total row and write a specific formula who works on total row.

For example:

```checkrow =
IF (
COUNTROWS ( table ) <> COUNTROWS ( ALLSELECTED ( table ) ),
"normula row",
"total row"
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Announcements