Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello Friends,
I have attached data table below:
I need distinct count of CustomerID for "V1-V2" Common Vertical.
Note: If any customer have only "V1" Vertical and "V1-V2-V3" then it will not count as V1-V2 Common Vertical.
Expected Output:
From dataset image only 2 customer in V1-V2 common group. so measure will give me 2 count.
Please help me out how to write dax for this type of condition.
Thank you once again in advance...!!!
Solved! Go to Solution.
@ravi_609
I tested withthe sample youprovided and it worked for me.can you explain how are youtrying to apply this measure?
My table:
The meaure and the result:
Porvide more details and screenshots of the error. You may also share dummy data that represent your actual data structure.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Share data in a format that can be pasted in an MS Excel file. Sharing an image is useless!!!!
@ravi_609
Try this measure:
COUNTROWS(
FILTER(
ADDCOLUMNS(
DISTINCT(Table06[CustomerID] ),
"V" ,
VAR __A = COUNTROWS( CALCULATETABLE( VALUES( Table06[Vertical] ) , TREATAS( {"V1" ,"V2"} , Table06[Vertical] )) )
VAR __B = COUNTROWS(CALCULATETABLE( VALUES( Table06[Vertical] ) ) )
RETURN
INT(AND(__A=2 ,__B=2))
),
[V] = 1
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy Thanks for the response but This measure is not working...!!!
I got solution with SQL Server Query:
SELECT CustomerID,COUNT(Verical)
FROM Vertical
GROUP BY CustomerID
HAVING CustomerID not in (Select CustomerID From Vertical where Verical not in ('V1','V2')) and COUNT(Verical) = 2
But I am stuck here that how to use this same logic into measure.
@ravi_609
I tested withthe sample youprovided and it worked for me.can you explain how are youtrying to apply this measure?
My table:
The meaure and the result:
Porvide more details and screenshots of the error. You may also share dummy data that represent your actual data structure.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
UniqueIDCount =
COUNTROWS(
FILTER(
SUMMARIZE(
YourTable,
YourTable[ID],
"Verticals", CONCATENATEX(VALUES(YourTable[vertical]), YourTable[vertical], ",")
),
(CONTAINSSTRING([Verticals], "V1") && CONTAINSSTRING([Verticals], "V2"))
&& NOT CONTAINSSTRING([Verticals], "V3")
)
)
not the most eloquent solution, but this should work
@Corey_M Thanks for the response but This measure is not working...!!!
I got solution with SQL Server Query:
SELECT CustomerID,COUNT(Verical)
FROM Vertical
GROUP BY CustomerID
HAVING CustomerID not in (Select CustomerID From Vertical where Verical not in ('V1','V2')) and COUNT(Verical) = 2
But I am stuck here that how to use this same logic into measure.
User | Count |
---|---|
93 | |
84 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
60 |