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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Count of combinations of values (measures) in a table (summarizing by multiple values?)

Hey there.
I have a table visualizing the number of different channels held by an employee. I have to count how many times each combination and number of channels appears.
Thus, instead of full names, I have to somehow summarize this data and get the number of full names for each combination (see the second screenshot).
Also, these counters are measures that take into the account start and end dates of the employees, so that the data can be filtered dynamically by date. That's why a calculated column won't probably be a solution.


Here's how my data looks like:
resource_allocation table:

allocation_code (PK)FullNamestart_dateend_dateEmails CallsSocial
1employee103/03/202008/11/2020111
2employee201/01/2019  2 
............   


sdr_channels table:

channel_code (PK)allocation_code (FK)sdr_channel
11Emails
21Calls
31Social
42Calls
.........

 

Note: 'Emails', 'Calls' and 'Social' in the resource_allocation table are calculated columns. I use the following formula:

1. Emails = CALCULATE ( MAX(resource_allocation[allocation_code]), FILTER(sdr_channels, sdr_channels[sdr_channel]="Emails" && resource_allocation[allocation_code]=sdr_channels[allocation_code]))
2. Calls = CALCULATE ( MAX(resource_allocation[allocation_code]), FILTER(sdr_channels, sdr_channels[sdr_channel]="Calls" && resource_allocation[allocation_code]=sdr_channels[allocation_code]))
3.  Social = CALCULATE ( MAX(resource_allocation[allocation_code]), FILTER(sdr_channels, sdr_channels[sdr_channel]="Social" && resource_allocation[allocation_code]=sdr_channels[allocation_code]))


The measures-counters for the table visual are:

Email counter = CALCULATE(CALCULATE(COUNT(resource_allocation[Email]),FILTER(resource_allocation, resource_allocation[Allocated (HR)]=1),ALLEXCEPT(resource_allocation,resource_allocation[employee_code])))
Calls counter = CALCULATE(CALCULATE(COUNT(resource_allocation[Calls]),FILTER(resource_allocation, resource_allocation[Allocated (HR)]=1),ALLEXCEPT(resource_allocation,resource_allocation[employee_code])))
Social counter = CALCULATE(CALCULATE(COUNT(resource_allocation[Email and Web]),FILTER(resource_allocation, resource_allocation[Allocated (HR)]=1),ALLEXCEPT(resource_allocation,resource_allocation[employee_code])))

Where 
Allocated (HR) =
VAR max_Selected_Date =
IF(HASONEVALUE(Rolling_Calendar[Year]), MAX(Rolling_Calendar[Calendar]), TODAY())
VAR min_Selected_Date =
IF(HASONEVALUE(Rolling_Calendar[Year]), MIN(Rolling_Calendar[Calendar]), TODAY())
RETURN
CALCULATE(
SWITCH(
TRUE(),
FIRSTNONBLANK ( resource_allocation[start_date], 1 ) <= max_Selected_Date &&
FIRSTNONBLANK( resource_allocation[end_date], 1 ) >= min_Selected_Date,
1,
FIRSTNONBLANK ( resource_allocation[start_date], 1 ) <= max_Selected_Date &&
MAX(resource_allocation[end_date])=BLANK(),1,
0
))


Tables' relationships:

tables relationship.png

The result I want to achieve:

Margaryta_0-1597260668681.png

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this measure:

Measure =
CALCULATE (
    COUNT ( 'Table'[Full Name] ),
    FILTER (
        ALL ( 'Table' ),
        COUNTROWS (
            FILTER (
                'Table',
                'Table'[Calls Counter] = EARLIER ( 'Table'[Calls Counter] )
                    && EARLIER ( 'Table'[Email Counter] ) = 'Table'[Email Counter]
                    && 'Table'[Social Counter] = EARLIER ( 'Table'[Social Counter] )
            )
        )
    )
)

V-lianl-msft_0-1597307499300.png

 

 

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

 

Anonymous
Not applicable

Thanks for your answer @V-lianl-msft .
However, I think I can't use EARLIER with a measure (while my counters are measures). The part

EARLIER ( 'Table'[Calls Counter] )

is underlined red and it says "Parameter is not the correct type".

Also, I can't edit this post properly for some reason, so I'll provide the additional info here...

Here's how my data looks like:
resource_allocation table:

allocation_code (PK)FullNamestart_dateend_dateEmails CallsSocial
1employee103/03/202008/11/2020111
2employee201/01/2019 2
............


sdr_channels table:

channel_code (PK)allocation_code (FK)sdr_channel
11Emails
21Calls
31Social
42Calls
.........



Emails, Calls and Social in resource_allocation table are calculated columns, which look like this:

Calls = IF(CALCULATE ( MAX(resource_allocation[allocation_code]), FILTER(sdr_channels, sdr_channels[sdr_channel]="Calls" && resource_allocation[allocation_code]=sdr_channels[allocation_code]))<>BLANK(),"C")

The counter-measures look the following way:
Calls counter = CALCULATE(CALCULATE(COUNT(resource_allocation[Calls]),FILTER(resource_allocation, resource_allocation[Allocated (HR)]=1),ALLEXCEPT(resource_allocation,resource_allocation[employee_code])))

Where the Allocated measure is:
Allocated (HR) =
VAR max_Selected_Date =
IF(HASONEVALUE(Rolling_Calendar[Year]), MAX(Rolling_Calendar[Calendar]), TODAY())
VAR min_Selected_Date =
IF(HASONEVALUE(Rolling_Calendar[Year]), MIN(Rolling_Calendar[Calendar]), TODAY())
RETURN
CALCULATE(
SWITCH(
TRUE(),
FIRSTNONBLANK ( resource_allocation[start_date], 1 ) <= max_Selected_Date &&
FIRSTNONBLANK( resource_allocation[end_date], 1 ) >= min_Selected_Date,
1,
FIRSTNONBLANK ( resource_allocation[start_date], 1 ) <= max_Selected_Date &&
MAX(resource_allocation[end_date])=BLANK(),1,
0
))

parry2k
Super User
Super User

@Anonymous your problem is not very clear. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.