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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.