Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I need to implement the below logic in DAX
If Direction = Inbound then COUNT DISTINCT (GS_SENDER_ID) else If Direction = Outbound then COUNT DISTINCT (GS_RECEIVER_ID)
and I have written the below code for first condition:
Partner Count = CALCULATE(DISTINCTCOUNT(Test[GS_SENDER_ID]), Test[Direction] = "I") , but how can I implement the 2nd condition here?
else If Direction = Outbound then COUNT DISTINCT (GS_RECEIVER_ID)
Hey,
maybe it is as simple as @PattemManohar already mentioned or it is much more complex.
I'm assuming that your dataset is about some kind of shipments and one shipment is either inbound (I) or outbund (O).
Now if you filter this dataset may contain rows that are eihter I or O, but nevertheless you need to know the number of distinct partners that have been engaged with the shipment.
I'm wondering if a partner can be either SENDER or RECEIVER depending on the direction of the shipment? And if this may be the case, if the same ID is used, and if you want a partner to be counted once no matter of the role the partner is playing?
Maybe you might consider to provide some sample data, upload the pbix to onedrive or dropbox and share the link.
Somehow, I'm hoping that the complexity of your question is of the latter 🙂 This will be fun.
Regards,
Tom
@Anonymous Please try this..
CountResult = VAR _InboundCount = CALCULATE(DISTINCTCOUNT(Test[GS_SENDER_ID]),Test[Direction]="I") VAR _OutboundCount = CALCULATE(DISTINCTCOUNT(Test[GS_RECEIVER_ID]),Test[Direction]="O") RETURN IF(Test[Direction]="I",_InboundCount,_OutboundCount)
Proud to be a PBI Community Champion
Hi,
I have used your expression and it gives me a error like below screen shot:
Hi @Anonymous,
Add a MIN if that formula is the solution.
if(MIN('Test'[Direction]) = "I",
Best Regards,
Dale
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
90 | |
72 | |
69 |
User | Count |
---|---|
232 | |
128 | |
117 | |
82 | |
82 |