Forum Discussion
Setting default value in Power BI filter, if nothing is selected
- 7 years ago
Anonymous Please try following steps
Method 1:
1)Duplicate Query 1 in query editor ( Ex: Report Query), delete all columns except the columns which you want to use it as a Slicer and remove duplicates. In this example I have used Company
2) Create a measure for default value using following expression (Replace with your columns)
Measure for Default Value = IF(NOT(ISFILTERED('Slicer'[Company ])),CALCULATE(SUM(Report[Sales]),FILTER('Slicer','Slicer'[Company ]="Company A")),SUM(Report[Sales]))3)Add Ok viz slicer to report and column which you want use for slicer
4)Now add newly created measure as Values in your chart. I will display some default value based on your expression. see the attached PBIX FYI.
T
Method 2: Create a measure as follows PFA PBIX
Measure = IF(COUNTROWS(DISTINCT(ALLSELECTED(Report[Company ])))<COUNTROWS(DISTINCT(ALL(Report[Company ]))),SUM(Report[Sales]),IF(SELECTEDVALUE(Report[Company ])="Company A",SUM(Report[Sales]),BLANK()))
There could different ways too.
Anonymous Please try following steps
Method 1:
1)Duplicate Query 1 in query editor ( Ex: Report Query), delete all columns except the columns which you want to use it as a Slicer and remove duplicates. In this example I have used Company
2) Create a measure for default value using following expression (Replace with your columns)
Measure for Default Value = IF(NOT(ISFILTERED('Slicer'[Company ])),CALCULATE(SUM(Report[Sales]),FILTER('Slicer','Slicer'[Company ]="Company A")),SUM(Report[Sales]))3)Add Ok viz slicer to report and column which you want use for slicer
4)Now add newly created measure as Values in your chart. I will display some default value based on your expression. see the attached PBIX FYI.
T
Method 2: Create a measure as follows PFA PBIX
Measure = IF(COUNTROWS(DISTINCT(ALLSELECTED(Report[Company ])))<COUNTROWS(DISTINCT(ALL(Report[Company ]))),SUM(Report[Sales]),IF(SELECTEDVALUE(Report[Company ])="Company A",SUM(Report[Sales]),BLANK()))
There could different ways too.