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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
YunJ
Post Prodigy
Post Prodigy

How to change default visual range under slicer?

Hi,

I used Store and Campaign as slicer in my dashboard. For example in this case, when Store=LRL FSS, Campaign=618, the Date start from 2020/5/25 to 2020/6/23.

1.png2.png

However, I want to change the date range (I don't want to change raw data), which means when Store=LRL FSS, Campaign=618, the Date will start from 2020/6/1 to 2020/6/30. But here you can see the end date of my new visual still is 2020/6/23.

3.png

Please find pbix file: 

https://www.dropbox.com/s/bow8o2210vwff0z/test%20%282%29.pbix?dl=0

Thanks a lot for your time!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @YunJ ,

I updated the pbix file, please check whether that is what you want.

1. Create a dimension table Campaigns, it include Store,  Campaign, Campaign start data and Campaign end date

Note: the data in the dimension table is just mockup data, you can fill it with the data which suitable for your scenario

2. Update the formula of measure Nspending

Nspending = 
VAR _mindate=CALCULATE(MAX('Campaigns'[Start]),FILTER('Campaigns','Campaigns'[Store]=SELECTEDVALUE('EC_campaign'[Store])&&'Campaigns'[Campaign]=SELECTEDVALUE('EC_campaign'[Campaign])))
var _maxdate=CALCULATE(MAX('Campaigns'[End]),FILTER('Campaigns','Campaigns'[Store]=SELECTEDVALUE('EC_campaign'[Store])&&'Campaigns'[Campaign]=SELECTEDVALUE('EC_campaign'[Campaign])))
return
CALCULATE (
    SUM ( 'EC_campaign'[Spending] ),
    FILTER ( 'EC_campaign', 'EC_campaign'[Date] >=_mindate &&'EC_campaign'[Date]<=_maxdate ) 
)

change default visual range under slicer_2.jpg

Best Regards

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @YunJ ,

As checked the data in table EC_campaign, it will only include the data with date from 5/25/2020 to 6/23/2020 when select the store is LRL FSS and the campaign is 618. Hence it will not display the data which date is after 6/23/2020... 

I updated your sample pbix file(see the page named "Duplicate of Page 2" in the attachment), please check whether that is what you want.

1. Delete the relationship between table Date and  EC_campaign

2. Create a date range slicer: put Date field from table Date on the slicer

3. Create another new measure to get  the spending and applied this new measure to replace the original Spending field on the visual

 

Nspending = 
CALCULATE (
    SUM ( 'EC_campaign'[Spending] ),
    FILTER ( 'EC_campaign', 'EC_campaign'[Date] = SELECTEDVALUE ( 'Date'[Date] ) )
)

 

change default visual range under slice.jpg

Best Regards

Hi @Anonymous 

I only want two slicers on the dashboard: Store and Campaign.

For example, when Store="LRL FSS" and Campaign="618", the date will be from 2020.06.01 to 2020.06.30.

when Store="LRL MU" and Campaign="38", the date will be from 2020.03.03 to 2020.03.20.

When other values selected, the date will also change based on specified condition.

Thanks a lot for your time.

Anonymous
Not applicable

Hi @YunJ ,

Could you please provide more details and explanation about the below 2 situations?

when Store="LRL FSS" and Campaign="618", the date will be from 2020.06.01 to 2020.06.30.

when Store="LRL MU" and Campaign="38", the date will be from 2020.03.03 to 2020.03.20.

For example: when Store="LRL MU" and Campaign="38"

Why the data range is from 2020.03.03 to 2020.03.20 not other one? Why it is not from 2020.2.24 to 2020.3.8? Is there any special reason or condition need to be met?

data range.JPG

Best Regards

Hi @Anonymous 

 

Thanks for your reply. 

 

In my dashboard, I have different visuals.

 

For some visuals, I can just use the default date in the dataset (which means in these visuals, for example when Store="LRL MU" and Campaign="38", the date will be from 2020.2.24 to 2020.3.8).

 

But in other visuals, I don't want use these date, so for example, when Store="LRL MU" and Campaign="38", I want the data range is from 2020.03.03 to 2020.03.20.

 

I can complete this by using a doubled data which contains different date, but I feel a little tricky. That's why I want to complete this by using measure.

Anonymous
Not applicable

Hi @YunJ ,

I updated the pbix file, please check whether that is what you want.

1. Create a dimension table Campaigns, it include Store,  Campaign, Campaign start data and Campaign end date

Note: the data in the dimension table is just mockup data, you can fill it with the data which suitable for your scenario

2. Update the formula of measure Nspending

Nspending = 
VAR _mindate=CALCULATE(MAX('Campaigns'[Start]),FILTER('Campaigns','Campaigns'[Store]=SELECTEDVALUE('EC_campaign'[Store])&&'Campaigns'[Campaign]=SELECTEDVALUE('EC_campaign'[Campaign])))
var _maxdate=CALCULATE(MAX('Campaigns'[End]),FILTER('Campaigns','Campaigns'[Store]=SELECTEDVALUE('EC_campaign'[Store])&&'Campaigns'[Campaign]=SELECTEDVALUE('EC_campaign'[Campaign])))
return
CALCULATE (
    SUM ( 'EC_campaign'[Spending] ),
    FILTER ( 'EC_campaign', 'EC_campaign'[Date] >=_mindate &&'EC_campaign'[Date]<=_maxdate ) 
)

change default visual range under slicer_2.jpg

Best Regards

Thanks a lot @Anonymous . That's what I want:)

MFelix
Super User
Super User

Hi @YunJ ,

 

Do you want to filter out the information or replace the Campaign date by the one in the formula? 

 

You are using a measure and that is a dinamic calculation so the date will appear but with a sum of 0.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

 

I want to replace the Campaign date by the one in the formula, which means in this situation, I want the date shown from 2020/6/1 to 2020/6/30.

 

Thanks for your time.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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