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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EZimmet
Resolver I
Resolver I

Assistance with DAX formulas

Thank you in advanced for assisting being a Newbie this forum is fantastic TY for all your help.

 

I’m looking to populate 2 fields in a report _Client Count & _Rack Shared

This is Computer racks filled with Client devices the final report will need to populate the two columns above.

_Client Count Total number of Clients in the Rack

_Rack Shared will need to calculate if >=2 clients Yes else No

 

My attempt below

 

_Client Count =

CALCULATE(

                COUNTROWS('Assets'),'Assets[ParentID]

                     in VALUES('Rack'[ID]))

 

_Rack Shared =

if Value from (Racks[_Client Count] >= 2

                then "Yes"

                Else "No")

 

 

Table: Assets
IDClientAsset TagHDW-EQTypeParentID
685440Client 1ATAG:101010ServerR001
685188Client 1ATAG:101011ServerR001
900561Client 2ATAG:101012ServerR001
712352Client 2ATAG:101013ServerR001
685204Client 3ATAG:101014ApplianceR001
685226Client 3ATAG:101015ApplianceR001

 

 

 

Table: Rack

IDAsset TagHDW-EQType_Client
 Count
_Rack Shared
R001ATAG:Rack1Rack3Yes

 

Capture.JPG

2 ACCEPTED SOLUTIONS
philouduv
Resolver III
Resolver III

Hey @EZimmet ,

For the first column : 

_Client Count =
CALCULATE(DISTINCTCOUNT(Assets[Client]),
FILTER(All(Assets),
Assets[ParentID] == EARLIER(Assets[ParentID])))

(It will count for ech different Parent ID how many clients are associate with)


Then for the second column :

_Rack Shared = If(Assets[_Client Count] >=2,"Yes","No"

(The second one is a simple IF use case , you could have find many examples on this forum or even the microsoft documentation IF function (DAX) - DAX | Microsoft Docs)

best regards,

View solution in original post

v-zhangti
Community Support
Community Support

Hi, @EZimmet 

 

You can try the following methods.

Column:

_Client Count = 
CALCULATE (
    DISTINCTCOUNT ( Assets[Client] ),
    FILTER ( Assets, [ParentID] = EARLIER ( Rack[ID] ) )
)
_Rack Shared = 
If([_Client Count] >=2,"Yes","No") 

vzhangti_0-1651112734332.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @EZimmet 

 

You can try the following methods.

Column:

_Client Count = 
CALCULATE (
    DISTINCTCOUNT ( Assets[Client] ),
    FILTER ( Assets, [ParentID] = EARLIER ( Rack[ID] ) )
)
_Rack Shared = 
If([_Client Count] >=2,"Yes","No") 

vzhangti_0-1651112734332.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

philouduv
Resolver III
Resolver III

Hey @EZimmet ,

For the first column : 

_Client Count =
CALCULATE(DISTINCTCOUNT(Assets[Client]),
FILTER(All(Assets),
Assets[ParentID] == EARLIER(Assets[ParentID])))

(It will count for ech different Parent ID how many clients are associate with)


Then for the second column :

_Rack Shared = If(Assets[_Client Count] >=2,"Yes","No"

(The second one is a simple IF use case , you could have find many examples on this forum or even the microsoft documentation IF function (DAX) - DAX | Microsoft Docs)

best regards,

Sorry for delay was on a work trip - TY 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.