Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Timo1980
Advocate I
Advocate I

Sum of previous months based on slicer selection

Hi all,

 

Below is a simplified view of my data set.

What i want to achieve with a measure in a card in the reporting pane,  is the total sum of active people calculated depending on date slicer setting (month).

So on the reporting site i have a slicer with months.  Now when I select a specific month in the slicer i get the total sum of active people.

 

So when i Select Jan the Card shows 1, for Feb it would show 2, Mar=2, May=3.......July=5  etc...

 

NameStart DateStatus
AJan/21Active
BFeb/21Active
CMar/21Inactive
DMay/21Active
EJun/21Active
FJul/21Active

 

I have tried a calculate sum with date filters equal or smaller to, but it only gives the sum of the specific date. Any help greatly appreciated!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Timo1980 

Please correct me if I wrongly understood your issue .

(1)Create a calculated column to judge the status for people . If is active return 1 ,then 0 .

column = IF('Employee Master'[Status]="Active",1,0)

Ailsa-msft_0-1623396972574.png

(2)Create a calendar date table and display with the form of a slicer .

Table = CALENDAR(DATE(2021,01,01),DATE(2021,12,31))

Ailsa-msft_1-1623396972575.png

Ailsa-msft_2-1623396972576.png

(3)Create a measure to return the total number of active people .

total active people = CALCULATE(SUM('Employee Master'[column]),FILTER('Employee Master','Employee Master'[Start Date]<=EOMONTH(MAX('Table'[Date]),0)))

The effect is as shown :

Ailsa-msft_3-1623396972578.png

I have attached my pbix file , you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Timo1980 

Please correct me if I wrongly understood your issue .

(1)Create a calculated column to judge the status for people . If is active return 1 ,then 0 .

column = IF('Employee Master'[Status]="Active",1,0)

Ailsa-msft_0-1623396972574.png

(2)Create a calendar date table and display with the form of a slicer .

Table = CALENDAR(DATE(2021,01,01),DATE(2021,12,31))

Ailsa-msft_1-1623396972575.png

Ailsa-msft_2-1623396972576.png

(3)Create a measure to return the total number of active people .

total active people = CALCULATE(SUM('Employee Master'[column]),FILTER('Employee Master','Employee Master'[Start Date]<=EOMONTH(MAX('Table'[Date]),0)))

The effect is as shown :

Ailsa-msft_3-1623396972578.png

I have attached my pbix file , you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VijayP
Super User
Super User

@Timo1980 
CALCULATE(SUM(COLUMN), FILTER(ALL(TABLE[status], Table[Status]="Active")




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


amitchandak
Super User
Super User

@Timo1980 , with disconnected date table in slicer

 

Till Date =
var _max = maxx(allselected(Date), Date[date])
return
calculate(countrows(Table), filter(Table, Table[Start DAte] <=_max))

 

 

With connected date slicer

Till Date =
var _max = maxx(allselected(Date), Date[date])
return
calculate(countrows(Table), filter(all(Date), Date[DAte] <=_max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

it is not working, i got an issue with the Date[date] fields they remain gray. ..

Table name is 'Employee Master' and Date column [Service Date]

these should all we need, correct?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors