cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mike12345
Frequent Visitor

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.

View solution in original post

amitchandak
Super User IV
Super User IV

@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 I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors