Hi Team,
I tried calculating Total available beds by using following DAX.
test =
DIVIDE(
CALCULATE(SUM(Data[Stats Data]), Data[Act/Bud]= “Act”,Data[Category] = “Available Bed”),
CALCULATE(COUNT(Data[FP]), Data[Act/Bud]= “Act”,Data[Category] = “Available Bed”))
Bed day Per Facility is correct but the total is the average of the total bed. 188 is incorrect. I would like to get 564.
Please see attached and can you please let me know correct DAX.
Many thanks.
This revised measure uses your calculation as the foundation, but then builds a simple 2-column virtual table, composed of facility in one column and your measure in the second column. It then checks via HASONEVALUE whether we’re in a data row or a total row. In the former case it returns your measure, in the latter case it returns a total via SUMX of the second column of the virtual table.
I hope this is helpful. Full solution file posted below.
Endlessly fascinating. Same problem, same tools, same end result, but two completely different approaches. @Harsh - I’ve seen a ton of different approaches to forcing the total (HASONEVALUE, ISFILTERED, ISINSCOPE, nesting within SUMX, etc.) but this is the first time I’ve seen someone do it with SWITCH(TRUE()). Very creative approach.
Hi @ammu, glad you made a progress with your query, please be sure to check out our DAX Clean Up tool it’s a great way to ensure to make your DAX code easy to read. Thanks!