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
mmorley
Frequent Visitor

Measure based on a multi-select slicer

Hi,

I'm trying to create a measure that obtains a count of records based on the records listed in the relevant months from the slicer selection.

 

I can get the list of months using

Multi_Selected_Months = CONCATENATEX ( VALUES ( TaskRange[Month] ), [Month], ",")

But when I use following or try different filters, I can't get the results I',m after

TotalTasks = 
Return
COUNTROWS(
    FILTER(
        All(TaskRange),
       TaskRange[Month]=[Multi_Selected_Months])
)

Someone might select january, february, may, august and I only need to see the totals for the months selected.

If I do a datebetween the first and last date selected this is fine

 

Any help appreciated

 

Thanks

1 ACCEPTED SOLUTION
mmorley
Frequent Visitor

Thanks all,

 

Managed to resolve it using the month table with the count of measure entries, I created another card that just used this and summed the values up for the selected months

 

View solution in original post

5 REPLIES 5
mmorley
Frequent Visitor

Thanks all,

 

Managed to resolve it using the month table with the count of measure entries, I created another card that just used this and summed the values up for the selected months

 

mmorley
Frequent Visitor

I've created a table for the dates to choose (to confirm it has no bearing on the issue), along with the totals for each month 

 
AllMonths = Distinct ( TaskRange[Month])
Total = COUNTROWS(FILTER(ALL(TaskRange),TaskRange[Month] = AllMonths[Month]))
 
MonthTotal
1/1/202255
1/2/2022145
1/3/2022543
1/1/20237
1/10/202115
1/11/2022325

 

The user can select mutliple dates from the range using a splicer and not in sequential format, so may choose 1/1/2022, 1/3/2022, 1/11/2022

 

I need to be able to add the totals for each month to get an overall figure which should be 55 + 543 + 321 = 919

 

But what happens is that I get blank as it only works for one month, i can't use other formulas as it seems to add everything that occurs between the min and max date

 

 

You could use TREATAS with your date slicer table

Total = CALCULATE( COUNTROWS(TaskRange), TREATAS( VALUES('Month Slicer'[Month]), TaskRange[Month]) )
mmorley
Frequent Visitor

The table I'm using already has a date range on it as it would appear in a seperate table, and is fine for all my other visuals as they are filtered on categories.

 

I'm creating another visual multi-card that contains a total count of all tasks within the range selected no matter what category they are and then another measure gets the total for the category to then do a percentage.

 

The measure based on the category within the range is correct, it's the overall I'm having an issue with

johnt75
Super User
Super User

Set up a proper date table and link that to your TaskRange table. Use columns from the Date table on your visuals, including the slicer, and your measure becomes simply

Total tasks = COUNTROWS( 'TaskRange')

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.