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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
newgirl
Post Patron
Post Patron

Sum of Full Month based on Date Slicer

Hello! In my report, I have a slicer date that lets the user select one date only. I have the raw data below.

I need a measure that would compute the sum of the amount of the FULL month based on selected date in the date slicer.

Sample Raw data (July full month sum is 2400 while August full month sum is 270).

 

So if the reader selects July 2, 2022, the measure output should be 2,400.

If the reader selected July 31, 2022, the measure output would still be 2,400.

If the reader selects AUgust 1, 2022, the measure output would be 270.

If the reader selects August 15, 2022, the measure output would still be 270.

fyi that I also have a second table which is the calendar table and it's the calendar table being used for the Date slicer.

 

DateAmount
7/1/2022100
7/2/2022100
7/3/2022100
7/4/2022100
7/5/2022100
7/6/2022100
7/7/2022 
7/8/2022 
7/9/2022100
7/10/2022100
7/11/2022100
7/12/2022100
7/13/2022100
7/14/2022100
7/15/2022 
7/16/2022 
7/17/2022 
7/18/2022100
7/19/2022100
7/20/2022100
7/21/2022100
7/22/2022100
7/23/2022100
7/24/2022100
7/25/2022100
7/26/2022100
7/27/2022100
7/28/2022100
7/29/2022100
7/30/2022 
7/31/2022 
8/1/202215
8/2/202215
8/3/202215
8/4/202215
8/5/202215
8/6/202215
8/7/2022 
8/8/2022 
8/9/202215
8/10/202215
8/11/202215
8/12/202215
8/13/202215
8/14/202215
8/15/2022 
8/16/2022 
8/17/202215
8/18/202215
8/19/202215
8/20/202215
8/21/202215
8/22/202215
8/23/2022 
8/24/2022 
8/25/2022 
8/26/2022 
8/27/2022 
8/28/2022 
8/29/2022 
8/30/2022 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @newgirl ,

Here are the columns of the table:

vyangliumsft_0-1657635888427.png

Here are the steps you can follow:

1. Create measure.

Solve1 =
var _select=SELECTEDVALUE('Date'[Date])
return
CALCULATE(SUM('Table'[Amount]),
FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(_select)&&MONTH('Table'[Date])=MONTH(_select)))
Solve2 =
var _select=SELECTEDVALUE('Date'[Date])
return
CALCULATE(
    SUM('Table'[Amount]),
    'Table'[Date]>=DATE(
    YEAR(_select),MONTH(_select),1)&&'Table'[Date]<=DATE(YEAR(_select),MONTH(_select)+1,1)-1)

2. Result:

vyangliumsft_1-1657635888431.png

If you need pbix, please click here.

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @newgirl ,

Here are the columns of the table:

vyangliumsft_0-1657635888427.png

Here are the steps you can follow:

1. Create measure.

Solve1 =
var _select=SELECTEDVALUE('Date'[Date])
return
CALCULATE(SUM('Table'[Amount]),
FILTER(ALL('Table'),
YEAR('Table'[Date])=YEAR(_select)&&MONTH('Table'[Date])=MONTH(_select)))
Solve2 =
var _select=SELECTEDVALUE('Date'[Date])
return
CALCULATE(
    SUM('Table'[Amount]),
    'Table'[Date]>=DATE(
    YEAR(_select),MONTH(_select),1)&&'Table'[Date]<=DATE(YEAR(_select),MONTH(_select)+1,1)-1)

2. Result:

vyangliumsft_1-1657635888431.png

If you need pbix, please click here.

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@newgirl ,

 

new measure =

var _max1 = maxx(allselected('Date'), 'Date'[Date])

var _max = eomonth(_max1,0)

var _min =eomonth(_max1,-1) +1 

return

// if table is joined to date table

calculate(Sum(Table[Qty]), filter(all('Date'), 'Date'[Date]>=_min && 'Date'[Date]>=_max) )

 

 

// if table is not joined to date table

calculate(Sum(Table[Qty]), filter(Table, 'Table'[Date]>=_min && 'Table'[Date]>=_max) )

 

 

Assumed slicer is on a date table(Connected or disconnected)

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

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.