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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
IF
Post Prodigy
Post Prodigy

Default selection with or without a slicer

Hi community,

 

I have a quite complicated scnario. Below you will find the example data, you can copy past to the power bi or you can download the file from: https://gofile.io/d/wo5E1V

 

I have a measure, which is working for the selection of slider1 or slider2. The measure is:

Plan Working3 =
VAR _slider1 = SELECTEDVALUE('Table'[Slider1])

 

RETURN
IF(ISFILTERED('Table'[Slider1]),
CALCULATE(Sum('Table'[Value]), All('Table'[Slider2])),
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#"))
)

 

I want to update the measure saying that: if slider1 or slider2 is not selected, show the value for Slider1="#", Slider2="#", MainFilter="V"

For example; slider1 and slider2 is not selected, Date is 07.2020 then the value should be 66.

 

If slider1 or slider2 is selected, then it should give the values, based on the measure "Plan Working3".

 

"Calendar" Table

MonthYearMonthYearDateOrder

11.2019Friday, November 1, 20191
12.2019Sunday, December 1, 20192
01.2020Wednesday, January 1, 20203
02.2020Saturday, February 1, 20204
03.2020Sunday, March 1, 20205
07.2020Wednesday, July 1, 20206
08.2020Saturday, August 1, 20207

 

Table "Table":

Slider1Slider2DateValueDateFormatedMainFilter

#A07.202012Tuesday, January 7, 2020#
#B07.202014Tuesday, January 7, 2020#
C1A07.202021Tuesday, January 7, 2020#
C2A07.202023Tuesday, January 7, 2020#
D1B07.202032Tuesday, January 7, 2020#
D2B07.202034Tuesday, January 7, 2020#
#A08.202042Wednesday, January 8, 2020#
#B08.202044Wednesday, January 8, 2020#
C1A08.202055Wednesday, January 8, 2020#
C2A08.202035Wednesday, January 8, 2020#
D1B08.202046Wednesday, January 8, 2020#
D2B08.202065Wednesday, January 8, 2020#
#A11.201977Friday, January 11, 2019#
#B11.201976Friday, January 11, 2019#
C1A11.201954Friday, January 11, 2019#
C2A11.201966Friday, January 11, 2019#
D1B11.201956Friday, January 11, 2019#
D2B11.201967Friday, January 11, 2019#
##07.202066Tuesday, January 7, 2020V
##08.202077Tuesday, January 7, 2020V
##11.201988Tuesday, January 7, 2020V

 

All the best,

1 ACCEPTED SOLUTION
lkalawski
Memorable Member
Memorable Member

Hi @IF ,

 

Please try this measure:

Plan Working = 
VAR _slider1 = SELECTEDVALUE('Table'[Slider1])

RETURN
IF(NOT(HASONEVALUE('Table'[Slider1])) && NOT(HASONEVALUE('Table'[Slider2])),
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#" && 'Table'[Slider2] = "#")),
[Plan Working3]
)



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@IF , Not very clear , something like this

 

switch( true(),
not(isfiltered('Table'[Slider1])) && not(isfiltered('Table'[Slider2])) , "#",
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#"))
)

Hi,

To make it clear, it will be easy to run the current measure without column "MainFilter". As you can see from the current measure you can select date; for example; 07.2020. If I select A, result is 12. Similarly the result is 14 for B, 21 for C1, 23 for C2, 32 for D1 and 34 for D2. Until it works.

What I want if either slider1 or slider2 is not selected, I want to see the value 66 as I explained at the previous post.

I hope it is clear.

Thanks in advance!

IF
Post Prodigy
Post Prodigy

Hi,

 Here is another link. https://gofile.io/d/cuPNYz

 I tried in two ways. The first file screen shots. If Slider1 or Slider2 is not selected, I want to see 66 value in a measure (for month 07.2020).

1.jpg2.jpg

I tried with another way at night. The link has second file.

3.jpg4.jpg

 

I saw a similar example with another project. It was not in a similar way, but mine doesn't work. 

 

If there is a better way of uploading the files, I can do it in that way. I think it is quite easy if you open the files.

 

All the best,

lkalawski
Memorable Member
Memorable Member

Hi @IF ,

 

Please try this measure:

Plan Working = 
VAR _slider1 = SELECTEDVALUE('Table'[Slider1])

RETURN
IF(NOT(HASONEVALUE('Table'[Slider1])) && NOT(HASONEVALUE('Table'[Slider2])),
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#" && 'Table'[Slider2] = "#")),
[Plan Working3]
)



_______________
If I helped, please accept the solution and give kudos! 😀

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.