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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
maiqqi
Frequent Visitor

Customers who bought parking slot with apartment

Hey

 

I'm investigating apartment and parking slot sales. I need to calculate how many apartment sales will be bought with a parking slot. 

 

1 Housing Company have parking slots and apartments.

1 apartment sale can be bought by multiple customers.

There is scenario that 1 apartment is sold with 1 parking slot to 2 customers but only 1 customer from these 2 customers bought the the parking slot. In this case the apartment is sold with parking slot.

 

The desired result would be like:

 

Apartment 1 Bought with parking slot

Apartment 2 Bought with parking slot

Apartment 3 Not bought with parking slot

 

After that I could make a analysis with different Housing companies with % of housing purchases with parking slot.

 
 

File:

 
 

https://www.dropbox.com/s/t1y9rx45s3z950v/Test.pbix?dl=0

 

Any ideas?

2 REPLIES 2
Greg_Deckler
Super User
Super User

So like this?

 

Measure = 
    VAR __All = COUNTROWS(FILTER('Items',[Type]<>"Parking Slot"))
    VAR __ParkingSlots = COUNTROWS(FILTER('Items',[Type]="Parking Slot"))
RETURN
    __ParkingSlots / __All

 

PBIX is attached.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi

 

Thank you for your reply @Greg_Deckler . This is still not enough. 

 

There can be a multiple bueyrs for apartment and the measure needs to be calculated per one apartment. So if there is 3 buyers for the apartment x and one of them buy one parking slot from the same housing company, the dax should say that the apartment was sold with parking slot.

 

I tried to make a dax but it does not work.

 

Apartment sales with parking spot =
var selectedcustomer = VALUES(Customers[CustomerID])
var selectedhousingcompany = VALUES('Housing companies'[HousingCompanyID])
var apartmentsales = CALCULATE([Apartment sales];selectedcustomer;selectedhousingcompany)
var parkingslotsales = CALCULATE([Parking slot sales];selectedcustomer;selectedhousingcompany)

return
IF(apartmentsales>=1&&parkingslotsales>=1;"Yes";"No")
 

link:

https://www.dropbox.com/s/wuhtqhiji3j5nmw/Test.pbix?dl=0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.