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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jeffreyjar
Helper II
Helper II

count the total of the agents in each category according to the first two characters

I want to create a measure to count the total of agents in each category based on the first two characters and base of their status(column ESTATUS) 

 

We have two tables

One is "agent list "

 

EAAGTNAMEEAADDR1EACITYEAFCREASTATUSNew Agents Codes
DIKOBE KONG CARINE MARIANNEYAOUNDE AA19906001
NGAGNI LAURENTYAOUNDE AA19999010
BILOA JOSEPHINEYAOUNDE AA19999035
TCHEUKO ROGERYAOUNDE AA29999002
POUNGOM EPSE NGAMALEU DENISEYAOUNDE AA29999005

 

The other one is table "AM"

CODE AGENCEAGENCENOM DU CHEF D'AGENCE
1A1YAOUNDE IMBA ELIE
2A2YAOUNDE IINANTCHOUANG ESTHER
3A3YAOUNDE IIIMEFFO ZOUNDA NICOLE
4A4YAOUNDE IVTCHOUKEU EPSE SIMO REGINE
5A5YAOUNDE VTEDECK JEAN LEOPOLD
6A6YAOUNDE VIZOUMA PARFAIT DESIRE
7A7YAOUNDE VIIKENGUELIBOU EPSE E. AMBROISINE
8A8BERTOUABOUMSONG BOUMSONG SOPHONIE S
9A9YAOUNDE VIIIYEBECK JOSEPHINE
10B1DOUALA INDEFO ETIENNE
11B2DOUALA IINONO MOUKETEY JOSIANE MELANIE
12B3DOUALA IIINSOM MICHAEL ANGOH
13B4DOUALA IVNDIKUM EDITH SWIRI EPSE FONKAH
14B5DOUALA VANGOA OHANA JEAN BAPTISTE
15B6LIMBEENOW PIUS OROCK
16B7BAFOUSSAMTAGNE BERNARD
17B8BAMENDATARDZENYUY STEPHEN
18B9GAROUAHAMADOU BOUBA
19C2NGAOUNDEREABE NGA SYMPHORIEN VITAL
20C3KRIBINGATOUM GUY LEONARD
21C4DOUALA 7OLI BELONG
22C5DOUALA 6PENE TINA EP.NGATCHOU JOELLE L
23C6EBOLOWAOWONA EYENE JEAN DEDIEU
24C1MAROUAHEUDAIBE BENJAMIN

 

For example the code A19906001(New Agents Codes column) of the agent list table  will belong to the agency(CODE AGENCE) A1 because the first two characters of the code is A1 and the status(ESTATUS) is A

2 REPLIES 2
Jeffreyjar
Helper II
Helper II

Hi @v-chenwuz-msft 

 

thanks for the reply i've tried it  but nothing appears as expected 

 

This is what im getting 

Jeffreyjar_0-1659825089083.png

Jeffreyjar_1-1659825153031.png

 

This my relationships

 

can i send you the .pbix file by mail? im unable to send it here

v-chenwuz-msft
Community Support
Community Support

Hi @Jeffreyjar ,

 

First, create a new column named New Agents Codes via 

New Agents Codes = LEFT([EASTATUS],2)

to get the first two characters.

 

Then, create a relationship between these two tables based on New Agents Codes and CODE AGENCE.

vchenwuzmsft_0-1659595381824.png

 

Last, drag New Agents Codes and CODE AGENCE field to table visual and set the aggregation of [New Agents Codes] as count. Refer the following screenshot.

vchenwuzmsft_1-1659595678058.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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