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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AA622
Helper II
Helper II

Show Distinct Count on a card based on multiple selections

I have to create a report where we have to show which flags are linked to which accounts. I have a slicer with the 12 flags (1-12) and it filters down to the main table showing account info. It contains the main 'Bill-to account' and under the main bill to accounts are the varous ship-to accounts. An example of what i am dealing with:

 

Bill to Account        Ship To Account

1                              A

1                              B

1                              C

 

Once i select the multiple flags the table will filter showing only those accounts will the certain flags. I just need a measure to help me show the DISTINCT COUNT of the bill-to accounts with the selected flags. In the example above the measure should show '1'.

 

I have a measure but i dont think it's going in the right direction since i got a number in the billions

 

BillToAccountCount = IF ( ISFILTERED ('TABLE'[FLAGTYPE]),
CONCATENATEX(ALLSELECTED(TABLE[BillToAccount]), TABLE[BillToAccount])
,
"No Accounts"
)
4 REPLIES 4
HotChilli
Super User
Super User

Can you give a slightly more complex example please (with more data) please?  There's no Flag Type in the supplied data.

Also, the measure has been written to return a string rather than an integer, so what is it you actually want (I would think that DISTINCTCOUNT plays a part) 

I simplified the Flag type by representing them as numbers (1-12)

 

At any point the user will select multiple flags and the main table with the account info will filter as such.

The table contains the main bill-to account in 1 column and then the next column will show the various ship-to accounts associated with the main bill-to account. example below

 

Bill To AcctShip To acct
100103
100101
100102
200201
200202

Distinct Count = 2 

 

I just need a measure to show the distinct count of bill to account(s) in the column.

 

The measure i created shows any account associated with the selected flags, so it'll show large figures. I need it to show the accounts associated with at least these selected flags.

So if 3 flags are chosen we want it to show the accounts that have AT LEAST those 3 flags but are not limited to. If one of those accounts shown have a 4th flag, it should still show. Obviously we can narrow it down by selecting said 4th flag.

Anonymous
Not applicable

Hi @AA622 ,


So basically you want filter the table according to selected flags and distinct count the bill to account? But what's the relationship between the flags and the table you shown above? Do you have flag column in the table above?

 

Best Regards,

Jay

Yes that is correct

 

I have a flag measure on the visual with the account information. I set it to "shows items when the value is _1_ "

 

the measure:

Invoices with all selected flags =
Var FLAGTYPECT = DISTINCTCOUNT('TABLE'[FLAG])
Var FLAGTYPEROWS = COUNTROWS(ALLSELECTED('TABLE'[FLAG]))
Var Result = IF(FLAGTYPECT = FLAGTYPEROWS, 1, 0)
RETURN

Result

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors