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
murugesh_c
Frequent Visitor

Slicer to compare data with previous months

Friends,

I want to compare previous months data for the selected days on the days slicer. For example, if I choose 1 to 12 days in the days slicer, then the first 12 days result of every month should show on the table. I truly appreciate your time on suggesting me a solution for this. Thanks. 

 

Power bi sllicer requirement 1.PNG

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

I am Not sure the intention of the slicer, but you can try like this.

 

a) Create a new parameter with numeric range

         1 to 31 with increment 1

sevenhills_0-1679031958791.png

 

Change the slicer as range

sevenhills_1-1679032269671.png

 

 

b) Optional: To test, you can do this measure

Selected Days = MIN('Days input'[Days input]) & " - " & MAX ('Days input'[Days input])

Create a card using this measure "Selected Days"

See if the slicer and the measure works correctly! it should match based on your selection.

 

c) Assuming

   c. 1. your Fact/transaction table and date table are created and relationships are set properly.

   c. 2. 'Dim Date' table has day column. We use this column to filter.

   c. 3.  Create new measure like this:

Count Rows - Filter Days Input = 
var _begin = Min('Days input'[Days input])
var _end = Max('Days input'[Days input])

return CALCULATE(countrows('Fact Sales'), -- Replace countrows with sum, count or ... as per your needs
          Filter('Dim Date', 'Dim Date'[Day] >= _begin && 'Dim Date'[Day] <= _end)
    )
    

 

Adjust the formula to your needs. i.e., countrows('Fact Sales') to meet your needs like sum, count ... and, change the 'Dim Date' table with your date table.

 

c.4. Use this measure in your matrix 

 

Hope this help!

 

 

View solution in original post

3 REPLIES 3
sevenhills
Super User
Super User

I am Not sure the intention of the slicer, but you can try like this.

 

a) Create a new parameter with numeric range

         1 to 31 with increment 1

sevenhills_0-1679031958791.png

 

Change the slicer as range

sevenhills_1-1679032269671.png

 

 

b) Optional: To test, you can do this measure

Selected Days = MIN('Days input'[Days input]) & " - " & MAX ('Days input'[Days input])

Create a card using this measure "Selected Days"

See if the slicer and the measure works correctly! it should match based on your selection.

 

c) Assuming

   c. 1. your Fact/transaction table and date table are created and relationships are set properly.

   c. 2. 'Dim Date' table has day column. We use this column to filter.

   c. 3.  Create new measure like this:

Count Rows - Filter Days Input = 
var _begin = Min('Days input'[Days input])
var _end = Max('Days input'[Days input])

return CALCULATE(countrows('Fact Sales'), -- Replace countrows with sum, count or ... as per your needs
          Filter('Dim Date', 'Dim Date'[Day] >= _begin && 'Dim Date'[Day] <= _end)
    )
    

 

Adjust the formula to your needs. i.e., countrows('Fact Sales') to meet your needs like sum, count ... and, change the 'Dim Date' table with your date table.

 

c.4. Use this measure in your matrix 

 

Hope this help!

 

 

Awesome. It works!
Thanks for drafting the solution in detail!

Glad to hear that it worked. Thanks

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