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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
YASHASHRI
Helper I
Helper I

Trying to get this result by using DAX or Power query

Hey all, 
I want to calculate the number of tenant per application.
1. I tried using power query i.e conditional column 
if application contains X give X, 
if application contains Y give Y, 
else Others 
But when i try to do that it is not giving me the accurate result 
if you can see tenant id "A" Has X ,Y,Z so it should be counted in three of the results but it is just showing it in the X and Others 
2. I even tried using dax 

Domain =
var X= CONTAINSSTRING([Applications],"X")
var Y= CONTAINSSTRING([Applications],"Y")
var Z= CONTAINSSTRING([Applications],"Z")
var T= CONTAINSSTRING([Applications],"T")
RETURN
IF(X=TRUE,"X",
    IF(Y=true,"Y",
        IF(Z=true,"Z",
            IF(T=true,"T", "Others"))))
Still not getting the result.

YASHASHRI_0-1669208379639.png

data---

Tenant ID Application 
AX,Y,Z
BY,R,T
CX,Y,T
DR,T,X

Please give me an suggestion how can i solve this problem. 

2 ACCEPTED SOLUTIONS
ERD
Community Champion
Community Champion

Hey @YASHASHRI , you can try this measure:

tenantID# =
VAR current_app = SELECTEDVALUE ( Table_2[Application] )
VAR tenantsWithApp = FILTER ( Table_, CONTAINSSTRING ( Table_[Application ], current_app ) )
RETURN
    IF ( ISFILTERED ( Table_2[Application] ), COUNTROWS ( tenantsWithApp ) )

ERD_1-1669211850649.png

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

ERD
Community Champion
Community Champion

@YASHASHRI , yes, this is the first table. And you need a table with your applications as a dimension table.

ERD_0-1669276583621.png

 

ERD_2-1669276614878.png

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

3 REPLIES 3
ERD
Community Champion
Community Champion

Hey @YASHASHRI , you can try this measure:

tenantID# =
VAR current_app = SELECTEDVALUE ( Table_2[Application] )
VAR tenantsWithApp = FILTER ( Table_, CONTAINSSTRING ( Table_[Application ], current_app ) )
RETURN
    IF ( ISFILTERED ( Table_2[Application] ), COUNTROWS ( tenantsWithApp ) )

ERD_1-1669211850649.png

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

what are you taking as Table_2 and Table_????

tenantID# =
VAR current_app = SELECTEDVALUE ( Table_2[Application] )
VAR tenantsWithApp = FILTER ( Table_, CONTAINSSTRING ( Table_[Application ], current_app ) )
RETURN
    IF ( ISFILTERED ( Table_2[Application] ), COUNTROWS ( tenantsWithApp ) )

Because in my case there is only one table and that is the below one 

Tenant ID Application 
AX,Y,Z
BY,R,T
CX,Y,T
DR,T,X
ERD
Community Champion
Community Champion

@YASHASHRI , yes, this is the first table. And you need a table with your applications as a dimension table.

ERD_0-1669276583621.png

 

ERD_2-1669276614878.png

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.