Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi Team,
I'm a beginner in using powerbi as well as qriting dax formula and hoping to ge help.
I am currently working on a table and tring to write a formula to get the max and average value og "Occupied", "Unoccupied" and dthe combined data for "Occupied" and "Signs of Life" to use as a score card. My table is laid out row=day, time, weekday and column = status. and example, say when I filter day=4 then the max value that should show from the score card will be 32.96% but if no filter is selected it will display the max/ ave value from all entries accross all dates. Thanks!
Thanks, but not sure where I missed the part but still not getting the correct expected result, I may have missed mentioning that the field i used for the column values is "Occupancy".
To achieve this in Power BI using DAX formulas, you can create calculated measures for the maximum and average values of the "Occupied", "Unoccupied", and combined "Occupied" and "Signs of Life" statuses. Here's how you can do it:
Assuming you have a table named YourTableName with columns: Day, Time, Weekday, and Status, you can create calculated measures as follows:
Max Occupied = MAXX(FILTER(YourTableName, YourTableName[Status] = "Occupied"), YourTableName[Occupied])
Average Occupied:
Average Occupied = AVERAGEX(FILTER(YourTableName, YourTableName[Status] = "Occupied"), YourTableName[Occupied])
Max Unoccupied:
Max Unoccupied = MAXX(FILTER(YourTableName, YourTableName[Status] = "Unoccupied"), YourTableName[Occupied])
Average Unoccupied:
Average Unoccupied = AVERAGEX(FILTER(YourTableName, YourTableName[Status] = "Unoccupied"), YourTableName[Occupied])
Max Occupied and Signs of Life Combined:
Max Occupied and Signs of Life Combined =
MAXX(
FILTER(
YourTableName,
YourTableName[Status] = "Occupied" || YourTableName[Status] = "Signs of Life"
),
YourTableName[Occupied]
)
Average Occupied and Signs of Life Combined:
Average Occupied and Signs of Life Combined =
AVERAGEX(
FILTER(
YourTableName,
YourTableName[Status] = "Occupied" || YourTableName[Status] = "Signs of Life"
),
YourTableName[Occupied]
)
These measures will calculate the maximum and average values for each category based on the filter context you apply in Power BI visuals or reports. Make sure to replace YourTableName with the actual name of your table. Also, ensure that the column names in the formulas match your actual column names.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 9 | |
| 5 | |
| 5 |