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

Looking for correct syntax please to pull multiple records

Looking for correct syntax please

I originally was only pulling 1 location full working code below.

Now need to alter the code to pull 3 specific locations from a region that has 10 locations into the mix for a grand total.

If someone can assist with the syntex on the first line the rest of the code will fall into place    

Just not sure after looking around how to add a Contains statement.    - TY 

 

Total =

VAR _count =

    COUNTX ( FILTER ( ( '_Rack Metrics Report' ),'_Rack Metrics Report'[Site] = "LOC1"),[Site] )

VAR _sum =

    SUMX ( FILTER ( ( '_Site_Max_Rack' ), '_Site_Max_Rack'[Site] = "LOC1" ),[Max_Racks] )

VAR _maxbuilt =

    SUMX ( FILTER ( ( '_Site_Max_Rack' ), '_Site_Max_Rack'[Site] = "LOC1" ),[Max_Built_Out] )

VAR _pwravail =

    COUNTROWS ( FILTER ( FILTER ( '_Rack Metrics Report','_Rack Metrics Report'[_All Rack Conditions] = "Installed Empty Powered Available"),'_Rack Metrics Report'[Site] = "LOC1"))

VAR _notpwr =

    COUNTROWS ( FILTER ( FILTER ( '_Rack Metrics Report','_Rack Metrics Report' [_All Rack Conditions] = "Installed Empty Not Powered"),'_Rack Metrics Report'[Site] = "LOC1"))

VAR _ceused =

    COUNTROWS ( FILTER ( FILTER ( '_Rack Metrics Report','_Rack Metrics Report' [_All Rack Conditions] = "Installed Client Ensono Used"),'_Rack Metrics Report'[Site] = "LOC1"))

RETURN

    SWITCH (

        TRUE (),

        MAX ( '_Max Racks'[Expected] ) = "Installed", _count +0,

        MAX ( '_Max Racks'[Expected] ) = "Max Allowed", _sum +0,

        MAX ( '_Max Racks'[Expected] ) = "White Space Capital Needed to Build Out", _sum - _maxbuilt +0,

        MAX ( '_Max Racks'[Expected] ) = "Max Supported", _maxbuilt +0,

        MAX ( '_Max Racks'[Expected] ) = "White Space Ready", _maxbuilt - _count +0,

        MAX ( '_Max Racks'[Expected] ) = "Install Empty Power Available", _pwravail +0,

        MAX ( '_Max Racks'[Expected] ) = "Install Empty Not Powered", _notpwr +0,

        MAX ( '_Max Racks'[Expected] ) = "Installed Client & Ensono Used", _ceused +0,

        MAX ( '_Max Racks'[Expected] ) = "Available Rack Capacity Today w/o Capital", _pwravail + _notpwr + _maxbuilt - _count +0)

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @EZimmet 

According to your description, you want to how to add a Contains statement for the '_Rack Metrics Report'[Site] ?

If this you can try to use "in" operator in dax code, like this:

VAR _count =

    COUNTX ( FILTER ( ( '_Rack Metrics Report' ),'_Rack Metrics Report'[Site] in { "LOC1","LOC2","LOC3"}),[Site] )

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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-yueyunzh-msft
Community Support
Community Support

Hi , @EZimmet 

According to your description, you want to how to add a Contains statement for the '_Rack Metrics Report'[Site] ?

If this you can try to use "in" operator in dax code, like this:

VAR _count =

    COUNTX ( FILTER ( ( '_Rack Metrics Report' ),'_Rack Metrics Report'[Site] in { "LOC1","LOC2","LOC3"}),[Site] )

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

OMG – I was trying to over complicate it looking for a List type container where a simple ~~ in ~~ condition was all I needed Thank you so much my PBI friend

OMG – I was trying to over complicate it looking for a List type container where a simple ~~ in ~~ condition was all I needed Thank you so much my PBI friend

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.