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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
iKitKat
Regular Visitor

Need slicer help on harvesting the desired/correct count of selected values.

Hello all,

I am creating a time based report with a matrix and a bar-line graph visual which uses DAX measures.

I use a COUNTROW(VALUES())) Dax measure to harvest the number of selections the viewer has made.

Here is the DAX measures in a simplified form:

Slicer Count =
    COUNTROWS(VALUES(SomeTable[SomeColumn]))

Another DAX measure =
    VAR divisor = 9 * [Slicer Count]

RETURN
SWITCH(
    TRUE(),
    ISINSCOPE(Date[Time]), BLANK(),
    ISINSCOPE(Date[Day]), MIN(1, [another measure which sums some values] + 0 / divisor)
)

The measure almost works the way I want it to however, if a filter selection has no data in a particular day, the count is less than I expect it to be.
iKitKat_1-1702857299585.png

For example, if the viewer selects two values in the slicer (record1 and record2) and Monday and Tuesday has no data, I want the calculation to be 0% + 100% / 9 * 2. However, the calculation is calculated as 100% / 9 * 1. 

Sorry if the solution is posted elsewhere but I have tried looking for one.









1 REPLY 1
123abc
Community Champion
Community Champion

It seems like you want to calculate a percentage based on the number of selected values in a slicer, and you want to include days with no data in the calculation. To achieve this, you can modify your DAX measure to consider all the days, even those with no data.

Here's a modified version of your DAX measure:

 

Slicer Count =
COUNTROWS(VALUES(SomeTable[SomeColumn]))

Another DAX measure =
VAR divisor = 9 * [Slicer Count]

RETURN
DIVIDE(
CALCULATE(
[another measure which sums some values],
ALL(Date)
),
divisor,
0
)

 

n this modified measure:

  1. CALCULATE([another measure which sums some values], ALL(Date)) calculates the sum of your values, but with the context of all dates. This ensures that even if a date has no data, it is still considered in the calculation.

  2. DIVIDE(..., divisor, 0) handles the division and includes a default value of 0 in case the divisor is 0.

This modification should give you the desired behavior where days with no data are included in the calculation, and the percentage is based on the total number of selected values in the slicer.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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