current month
2 TopicsHelp Needed with DAX Expression for Current and Future Month Calculations
Hi everyone, I’m working on a DAX expression to calculate a display value for a line chart in Power BI. My goal is to correctly handle data for the current month and future months with the following requirements: For the current month: I need to combine the cumulative sum of actual values with the rolling wave forecast value. For future months: The display value should consist of the cumulative sum of the actual values from the current month plus the forecast value for that future month. Here's the DAX expression I have so far: Display Value = VAR IsCurrentMonth = YEAR([Date]) = YEAR(TODAY()) && MONTH([Date]) = MONTH(TODAY()) VAR IsFutureMonth = YEAR([Date]) > YEAR(TODAY()) || (YEAR([Date]) = YEAR(TODAY()) && MONTH([Date]) > MONTH(TODAY())) VAR CurrentMonthActualCumulativeSum = CALCULATE( MAX([Actual Cumulative.Sum]), FILTER( ALLSELECTED(), YEAR([Date]) = YEAR(TODAY()) && MONTH([Date]) = MONTH(TODAY()) ) ) RETURN IF( [Series Type] = "Rolling Wave Forecast", IF( IsCurrentMonth, [Actual+Rolling Wave Forecast], IF( IsFutureMonth, CurrentMonthActualCumulativeSum + [Value], [Actual+Rolling Wave Forecast] ) ), [Value] ) The Problem: When I add this measure to a line chart, the current month’s values display correctly. However, for future months, the cumulative sum is incorrectly added multiple times. For example, in the next month, the cumulative sum of the actual values from the current month is added again, and this continues to accumulate incorrectly in subsequent months. What I Need: I need the calculation to add the cumulative sum of the actual values only once for the current month and then add the forecast value for each future month without repeating the cumulative sum. Any guidance on how to fix this issue would be greatly appreciated! Thank you! (Images with captions are below)818Views0likes3Commentscalculate active customers previous month and current month
I have 3 columns and I want to get active customers for current month where status = "won" and active customers for previous month where status = "won" for current month im using ActiveMembers = CALCULATE(DISTINCTCOUNT(Table[Customer]),PARALLELPERIOD(table[Date],0,MONTH),FILTER( 'Table','table'[Status] ="won" )) and it's working fine. but i have getting no value for previous month and I'm using: ActiveMemberPreviousMonth = CALCULATE(DISTINCTCOUNT('table'[Customer]),PREVIOUSMONTH('table'[Date]), FILTER('table','table'[Status]="Won")) Problem statement: I want help to get current active member and previous month active member where status = "Won" expected solution: eg: if today is 12 March 2021: I want active users of the current month March 2021: 5364 users and previous month i.e Feb 2021 : active users 3265 users. my example data for the table is shown below customer date status xyz 03-01-2018 won abc 03-01-2018 lost efd 03-01-2018 won ghy 03-01-2018 lost tgh 05-02-2018 won fht 01-01-2019 wonSolved6.4KViews0likes9Comments