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.
Hi all,
I'm really new to PowerBI, but I'm creating a dashboard for the real estate company where I work to check our current apartment occupancy. All of our bookings go through our website, so all of our apartments have a 'status' column in the database. This column either says 0 (available), 1 (in option) or 2 (rented out).
I'm trying to use the gauge visualization to check how many apartments have 'status' = 2 as the value (using COUNT in the visualization fields), with the maximum value being the COUNT of rows in the database. However, because I'm filtering the apartments with 'status' = 2, Power BI only counts the rows where 'status' = 2 for the maximum value. This results in being the value and the maximum value to be equal to eachother.
Does anyone know how I can fix this? I've tried searching on the forums already, without any luck unfortunately...
Hi @Anonymous ,
You could use two measures to show the result.
CurrentCount =
CALCULATE (
COUNT ( 'Table'[apartmentno] ),
FILTER ( 'Table', 'Table'[status] = 2 )
)
AllCount =
COUNT('Table'[apartmentno])
When the database data is updated, you could click update button to refresh data. The measure will return the latest result.
Hi @v-eachen-msft, thanks for the help.
May I ask how I create two seperate measures? See the screenshot below on how I have my data filtered right now:
Count of apartmentid should be somewhere around 285, but because on the filter on status, it only counts the apartmentid's with status = 2.
I hope you'll be able to help 🙂
Edit: fiddled around with measures and figured it out using the measures @v-eachen-msft provided 🙂
@Anonymous You question is clear but not sure what is your expected result. share sample data and expected output, it will help to get you the solution.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k Will do! I will provide some small dummy data.
So I have my apartments table in my MySQL database:
apartmentno | status |
1.0 | 2 |
1.1 | 1 |
1.2 | 2 |
1.3 | 2 |
1.4 | 0 |
1.5 | 0 |
In the example above, there are three 'rented out' apartments, two 'available' apartments and one 'in option' apartment, which makes for a total of six apartments.
In my gauge, I want the minimum value to be 0 (which is default), the maximum value to be 6 (the total apartments) and the (current?) value to be 3. I could manually set the maximum value to 6, but I'd like this value to be dynamic, since we are expected to rent out more apartments in the near future. When adding these apartments to our website, the maximum value would then automatically be updated out of the database.
I hope my expected result is more clear now 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |