Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I have a Sales table by month:
Date | Option | Sales |
Jan-2019 | A | 1 |
Jan-2019 | B | 2 |
Feb-2019 | A | 3 |
Feb-2019 | B | 4 |
Mars-2019 | A | 5 |
Mars-2019 | B | 6 |
I want to build a groupby table summing sales. For example, an output I would like :
If I filter on Date between Feb2019 and June2019 : I would like :
Date | Sum of sales |
M1 | 7 |
M2 | 11 |
with :
- M1 = first month of the filter
- M2 = second month of the filter ...
Do you know if it is possible to build this column ?
Thanks in advance,
I tried everything and cannot obtain this result 😞
Solved! Go to Solution.
I did it on an existing model, so you can adapt same approach. I made the disconnected table called MonthTable.
And my Date table already had a column for the MonthEnding, so I used that in this measure to get the result shown.
SlicerMonth =
VAR slicermon =
MIN ( MonthTable[MonthsAway] )
VAR EOMminslicerdate =
EOMONTH ( MIN ( 'Date'[Date] ), slicermon )
RETURN
CALCULATE ( [Total Sales], 'Date'[MonthEnding] = EOMminslicerdate )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi, Thanks a lot for your help !
I created this PBIX and the disconnected table. I was stuck on how you create the variable MonthFromSelection ?
To do that, you need to create a disconnected table like the one below, and then in a variable in your measure calculate the month that would be that many MonthsFromSelection from the min date from the slicer. You would then return your measure (sum in your case) for that month.
Month |
MonthsFromSelection |
M1 | 0 |
M2 | 1 |
M3 | 2 |
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi, Thanks a lot for your help !
I created this PBIX and the disconnected table. I was stuck on how you create the variable MonthFromSelection ?
I did it on an existing model, so you can adapt same approach. I made the disconnected table called MonthTable.
And my Date table already had a column for the MonthEnding, so I used that in this measure to get the result shown.
SlicerMonth =
VAR slicermon =
MIN ( MonthTable[MonthsAway] )
VAR EOMminslicerdate =
EOMONTH ( MIN ( 'Date'[Date] ), slicermon )
RETURN
CALCULATE ( [Total Sales], 'Date'[MonthEnding] = EOMminslicerdate )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
42 | |
30 | |
27 | |
26 |