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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors