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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mike12345
Helper I
Helper I

Help with visual

Hi Everyone 

 

Looking for some help with a visual.

 

I have a table called dealer with a dealer code, name, city, state, etc.

I have a table called inventory that has Vin numbers in it.  These may or may not be associated with a dealer code.  The dealer code field in the inventory table will be populated if the Vin is assigned to that dealer.  The dealer table and inventory table are joined by dealer code.

 

want to show a table with a count of VINs by dealer code.  The issue is I want to see all dealer codes even if they do not have a Vin in the inventory table ( so a count of zero ).  Basically I want to see dealer codes from the dealer table that does not have a Vin assigned.  Can this be done?  Thanks.

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @mike12345 ;

If you want to see all dealer codes, You could use dealer code from inventory table and create a measure to count, The other way is to create a new table and count it, as follows:

Method 1:create a measure and use dealer code from inventory table

count of VINS = 
var _new=SUMMARIZE('dealer',[Dealer code])
return IF(MAX([Dealer code]) in _new,COUNT('dealer'[DealerCode ]),0)

The final output is shown below:

v-yalanwu-msft_0-1623737849229.png

Method 2: create a new table:

NewTable = 
VAR _A=SELECTCOLUMNS('dealer',"DealerCode",[DealerCode ],"value",1)
VAR _B=SELECTCOLUMNS('inventory',"DealerCode",[Dealer code],"value",0)
RETURN UNION(_A,_B)

Then create a measure to count:

count of VINS2 = SUM('NewTable'[value])

The final output is shown below:

v-yalanwu-msft_1-1623737982732.png

Best Regards,
Community Support Team_ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @mike12345 ;

If you want to see all dealer codes, You could use dealer code from inventory table and create a measure to count, The other way is to create a new table and count it, as follows:

Method 1:create a measure and use dealer code from inventory table

count of VINS = 
var _new=SUMMARIZE('dealer',[Dealer code])
return IF(MAX([Dealer code]) in _new,COUNT('dealer'[DealerCode ]),0)

The final output is shown below:

v-yalanwu-msft_0-1623737849229.png

Method 2: create a new table:

NewTable = 
VAR _A=SELECTCOLUMNS('dealer',"DealerCode",[DealerCode ],"value",1)
VAR _B=SELECTCOLUMNS('inventory',"DealerCode",[Dealer code],"value",0)
RETURN UNION(_A,_B)

Then create a measure to count:

count of VINS2 = SUM('NewTable'[value])

The final output is shown below:

v-yalanwu-msft_1-1623737982732.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@mike12345 , Create a measure like this and plot with the dealer

 

if(isblank(countrows(inventory)), 1, blank())

 

or

 

countx(values(dealer[dealer code]), if(isblank(countrows(inventory)), [dealer code], blank()) )

Did not work.  The measure has no data.

 

OnePerDealer = countx(values(DealerMaster[DEALERCODE]), if(isblank(countrows(Inventory)), [DEALERCODE], blank()) )
 
I am wanting to see something as follows:
DealerCode               Count of VINS
A                                5
B                                3
C                                0
D                               11
E                                0
 
Thank You.
 

@mike12345 

could you please provide the sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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