Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
Solved! Go to Solution.
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:
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:
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.
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:
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:
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.
@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.
could you please provide the sample data and expected output?
Proud to be a Super User!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |