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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

banding - count

Hello,
from a DirectQuery, I get a table named as tblPerformance which has columns like:
pKey Performance
asd 10
gfd 34
xyz 39
...

I have manually created a table for banding as follows:
tblBanding
Low High Band
0 20 less than 20
20 30 20 to less than 30
30 40 30 to less than 40
...

I would like to create a report to show:
i.e.
Band Group count
less than 20 count of pKeys where their performance is less than 20
20 to less than 30 count of pKeys where their performance is 20 to less than 30
...

Thank you

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Try to count it directly:

Measure = 
COUNTAX(
    FILTER(
        'tblPerformance',
        [Performance] >= SELECTEDVALUE(tblBanding[Low]) && [Performance] <= SELECTEDVALUE(tblBanding[High])
    ),
    [pKey]
)

r2.png

 

Best Regards,
Yingjie Li

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

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , refer if this can help


https://www.daxpatterns.com/dynamic-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi, It looks like th eissue I am have is to do with the DirectQuery table
because in my measure, inside the filter, I do not see in intellisense the field tblPerformance[Performance]
Any suggestions?

Thanks

Hi @Anonymous ,

The reason that you cannot quote tblPerformance[Performance] in the filter formula in tblBanding is that there is no relationship between these tables.

You can try this measure:

 

count =
VAR tab =
    SUMMARIZE (
        'tblPerformance',
        'tblPerformance'[Performance],
        'tblPerformance'[pKey]
    )
RETURN
    COUNTAX (
        FILTER (
            tab,
            [Performance] >= SELECTEDVALUE ( tblBanding[Low] )
                && [Performance] < SELECTEDVALUE ( tblBanding[High] )
        ),
        [pKey]
    )

 

tblPerformance in my sql server database using direct query in power bi desktop:

sql server database.png

tblBanding by entering data manually using import mode in power bi desktop:

tblBanding.png

 

Using a table visual to show the final result:

result.png

 

Best Regards,
Yingjie Li

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

 

Anonymous
Not applicable

hi, what does the word tab do in the filter? I thought it should be a table instead?

Thanks

Anonymous
Not applicable

//This gives the number 1440, but the dax you sent me gives 1442 maybe I have the signs mixed up somewhere? thanks //count measure Performance Count greater than or equal to 0 to less than 0.01 = CALCULATE(COUNTROWS('Unitised Performance'), 'Unitised Performance'[Performance] >= 0 && 'Unitised Performance'[Performance] < 0.01 ) count = VAR tab = SUMMARIZE ( 'Unitised Performance', 'Unitised Performance'[Performance], 'Unitised Performance'[Portfolio Key] ) RETURN CALCULATE ( COUNTAX ( FILTER ( tab, [Performance] >= SELECTEDVALUE ( PerformanceBands[Low] ) && [Performance] < SELECTEDVALUE ( PerformanceBands[High] ) ), 'Unitised Performance'[Portfolio Key] ) )

Hi @Anonymous ,

Try to count it directly:

Measure = 
COUNTAX(
    FILTER(
        'tblPerformance',
        [Performance] >= SELECTEDVALUE(tblBanding[Low]) && [Performance] <= SELECTEDVALUE(tblBanding[High])
    ),
    [pKey]
)

r2.png

 

Best Regards,
Yingjie Li

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

 

Anonymous
Not applicable

Hi, the second simplified dax is good.
Since there is no relationship between the performance table and the Band table, how can I create a column char with count on y axis and band range on x axis?
Thank you

Hi @Anonymous ,

You can create a column chart like this:

column chart.png

 

Best Regards,
Yingjie Li

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.