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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
dcg38524
Helper III
Helper III

Slicer's using percentage of selected totals

Hello,

I have a query on using a yearly slicer or any created slicer using DAX code which illustrates the percentage of countrows (see code below).  Is there anyway if I select a single "Year" using already created slicer only the results of that particular year countrow total is being calulated per. percentage? 

 

If I select multiple slicer's is it possible to only illustrate total percentages of those selected categories?

 

I've seen some solutions on the web that used DAX's SELECTEDVALUES but it's not very clear on how to apply that to my problem.

 

Thank you for your help

 

Before Year is Selected

Dashboard Slicer Filter.jpg

After "Year" is selected

Dashboard Slicer Filter 2.jpg

 

 

 

 

Percentage Accepted = 
VAR _SelectPeriod =
    CALCULATE(
        COUNTROWS(FILTER('MajorIncidentTickets_2022-23','MajorIncidentTickets_2022-23'[major_incident_state]="Accepted")))

VAR _Total =
	COUNTROWS(FILTER('MajorIncidentTickets_2022-23','MajorIncidentTickets_2022-23'[major_incident_state]="Accepted")
	
)
RETURN
    DIVIDE ( _SelectPeriod, _Total )

 

 

 

  

1 ACCEPTED SOLUTION
dcg38524
Helper III
Helper III

I was able to find a solution(see below) using the "SELECTEDVALUE" along with other parameters

 

TestSlicer = 
    VAR selectedYear = SELECTEDVALUE('MajorIncidentTickets_2022-23'[Promote Duration])
        return
            CALCULATE([TotalPromote],
                FILTER('MajorIncidentTickets_2022-23','MajorIncidentTickets_2022-23'[Promote Duration]=selectedYear)
    )

 

View solution in original post

2 REPLIES 2
dcg38524
Helper III
Helper III

I was able to find a solution(see below) using the "SELECTEDVALUE" along with other parameters

 

TestSlicer = 
    VAR selectedYear = SELECTEDVALUE('MajorIncidentTickets_2022-23'[Promote Duration])
        return
            CALCULATE([TotalPromote],
                FILTER('MajorIncidentTickets_2022-23','MajorIncidentTickets_2022-23'[Promote Duration]=selectedYear)
    )

 

igrandey89
Advocate II
Advocate II

Correct, you should also be able to go to format and configure how the visuals interact with each other (cross-filter/cross-highlight/none)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.