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

Dynamic frequency distribution (count of counts) with date slicer

Say I have a sample data below:

 

Transaction IDStaff IDProvider IDProduct typeDate
TR0000001ST001PR001Fruits05/01/2018
TR0000002ST001PR001Fruits06/01/2018
TR0000003ST001PR001Fruits07/01/2018
TR0000004ST001PR001Fruits08/01/2018
TR0000005ST001PR001Stationary09/01/2018
TR0000006ST001PR001Stationary10/01/2018
TR0000007ST007PR001Stationary11/01/2018
TR0000008ST007PR001Stationary12/01/2018
TR0000009ST007PR001Stationary13/01/2018
TR0000010ST007PR001Stationary14/01/2018
TR0000011ST007PR001Stationary15/01/2018
TR0000012ST007PR001Stationary16/01/2018
TR0000013ST007PR001Stationary17/01/2018
TR0000014ST007PR001Stationary18/01/2018
TR0000015ST007PR001Stationary19/01/2018
TR0000016ST007PR001Stationary20/01/2018
TR0000017ST007PR001Stationary21/01/2018
TR0000018ST007PR001Stationary22/01/2018
TR0000019ST007PR001Stationary23/01/2018
TR0000020ST007PR002Stationary24/01/2018
TR0000021ST007PR002Stationary25/01/2018
TR0000022ST007PR002Stationary26/01/2018
TR0000023ST007PR002Stationary27/01/2018
TR0000024ST007PR002Stationary28/01/2018
TR0000025ST025PR002Stationary29/01/2018
TR0000026ST025PR002Drinks30/01/2018
TR0000027ST025PR002Drinks31/01/2018
TR0000028ST025PR002Drinks01/02/2018
TR0000029ST025PR002Drinks02/02/2018
TR0000030ST025PR002Drinks03/02/2018
TR0000031ST025PR003Drinks04/02/2018
TR0000032ST025PR003Drinks05/02/2018
TR0000033ST025PR003Drinks06/02/2018
TR0000034ST034PR003Drinks07/02/2018
TR0000035ST034PR003Drinks08/02/2018
TR0000036ST034PR003Drinks09/02/2018
TR0000037ST038PR003Drinks10/02/2018
TR0000038ST038PR003Drinks11/02/2018
TR0000039ST038PR003Drinks12/02/2018
TR0000040ST040PR003Drinks13/02/2018

 

My question contains two main parts:

 

First part is that I want to create a table with a date slicer so I can filter the data I am accessing.

I want to have a result table such that if my slicer is selected as 14/01/2018 - 13/02/2018

 

I will have the result table:

Number of transactionsnumber of staff
11
32
91
151

 

Second part is that I want a further classification on Provider ID and Product type such that I have the result table:

Provider IDProduct typeNumber of transactionsnumber of staff
PR001Stationary101
PR002Stationary11
PR002Stationary51
PR002Drinks51
PR003Drinks11
PR003Drinks33

 

I tried using extra calculated column but it is not dynamic with the slicer.

 

Thank you very much!

1 ACCEPTED SOLUTION

Hi @tmv3v ,

Maybe the formulas below can help you.

  • Create two calculated tables
Table 1 =
GENERATESERIES (
    1,
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count of Transaction", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count of Transaction]
    )
)


Table 2 =
GENERATESERIES (
    1,
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            'Table'[Provider ID],
            'Table'[Product type],
            "Count of Transaction", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count of Transaction]
    )
)

3.PNG

  • Create measures
Number of Staff =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count] IN FILTERS ( 'Table 1'[Number of Transaction] )
    )
)


Measure =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count] IN FILTERS ( 'Table 2'[Number of Transaction] )
    )
)

4.PNG

Best Regards,

Xue Ding

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

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

View solution in original post

3 REPLIES 3
sanalytics
Super User
Super User

Hey @tmv3v ,

Need little clarification.
For the second part, you need classification on Provider ID and Product Type  then why same Provider ID and Product Type appears multiple times into your expected output table? for example,PR003 and releated product types drinks appear two times.

 

Your given data says that,No. of transaction of Provider ID "PR003" and Product Type "Drinks" is 10 but your expected output table says 4 (1,3)..

on the First Part, you need No.of Transaction and No.of Staff by which classification ?

Please Clarify the above doubts.

Regards,

snandy

 

Thanks for your reply! Sorry for being unclear.

 

All the distributions are based on staff ID. 

 

For the first part, the data (3, 2) means there are two distinct staff who were responsible for 3 transactions for the time period.

 

For the second part it's a nested frequency distribution where I want a distribution for every unique (Provide ID+Product type) combination on staff ID. So for "PR003", there is only product type - drinks and the result table is saying that there is one staff who was responsible for 1 transaction and 3 staffs who were responsible for 3 transactions, giving 1+3*3=10.

 

For the second part I have the idea of using matrix and putting Provider ID and Product type into the row section, and then using the drilldown button and drill all the way to the bottom. But first I have to solve the first problem.

 

Thank you!

Hi @tmv3v ,

Maybe the formulas below can help you.

  • Create two calculated tables
Table 1 =
GENERATESERIES (
    1,
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count of Transaction", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count of Transaction]
    )
)


Table 2 =
GENERATESERIES (
    1,
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            'Table'[Provider ID],
            'Table'[Product type],
            "Count of Transaction", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count of Transaction]
    )
)

3.PNG

  • Create measures
Number of Staff =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count] IN FILTERS ( 'Table 1'[Number of Transaction] )
    )
)


Measure =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Staff ID],
            "Count", DISTINCTCOUNT ( 'Table'[Transaction ID] )
        ),
        [Count] IN FILTERS ( 'Table 2'[Number of Transaction] )
    )
)

4.PNG

Best Regards,

Xue Ding

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

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

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.