Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Running Total for workdays

I need some help about making a different calculation. I have a dataset like that.                                             The first table shows how much spe...
  • v-danhe-msft's avatar
    7 years ago

    Hi Anonymous,

    Based on my test, you could refer to below steps:

    Created two columns in 'Master Data' table:

    Column = CALCULATE(MAX('Target Data'[TARGET]),FILTER('Target Data','Target Data'[MONTH]='Master Data'[Month]))
    Column 2 = [Column]-CALCULATE(SUM('Master Data'[OUTGO]),FILTER('Master Data','Master Data'[Date]<EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))
    Create a relationship between below tables:
    Create a column in 'Example Data' table:
    Related Column = DIVIDE(RELATED('Master Data'[Column 2]),'Example Data'[Column5])
    Result:
    You could also download the pbix file to have a view.
     
    Regards,
    Daniel He
  • Anonymous's avatar
    Anonymous
    7 years ago

    Firstly thank you for your reply.

    It looks like fine but one case was missed.

     

    Actually i don't have ExampleData table. I was added it for show to 'column5' calculation logic.

    I have to make this calculation in MasterData table.

    In summary this solution is okey but i need to create a new column like 'Column5' in MasterData table.

  • v-danhe-msft's avatar
    v-danhe-msft
    7 years ago

    Hi Anonymous,

    Based on my test, you could refer to below steps:

    Enter a map table like below:

    Create a week number column in 'Master Data' table:

    Weeknum = WEEKDAY('Master Data'[Date],2)

    Create relationship between two tables:

    Create below calculated columns:

    Column 3 = RELATED(Map[value])
    Column 4 = CALCULATE(SUM('Master Data'[Column 3]),FILTER('Master Data','Master Data'[Date]>=EARLIER('Master Data'[Date])&&'Master Data'[Month]=EARLIER('Master Data'[Month])))

    Result:

    You could also download the pbix file to have a view.

     

    Regards,

    Daniel He