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.
In the below matrix, I am trying to display the number of sessions and number of doctor days per clinic location. But the sum and totals are wrong (the below visual is for the period of 2021 and 2022 (2 years worth of data)):
The DAX for Doctor days is simple: No. of sessions / 2
The trouble is the No of sessions is giving me the wrong figures. See below DAX:
No of Sessions =
VAR _encounters =
Calculate(DISTINCTCOUNT('Transaction Attributes'[Encounter Number__EBM__Encounter Number]),Filter ('Transaction Attributes', 'Base Measures'[Charges]>0))
RETURN
SWITCH (
TRUE (),
_encounters <= 2, 0,
_encounters >= 2
&& _encounters <= 10, 1,
_encounters > 10, 2
)
[Charges] is a very simple measure:
Charges =
CALCULATE (
[Amount],
FILTER (
ALL ( 'Profitability Account' ),
'Profitability Account'[Description] = "Charges"
)
)
What could I be doing wrong? The measure works for 1 day per location but when I look at extended period of times like 1 week/ 1 month or 1 year it doesnt total the value of No. of sessions properly.
Please help! If you need any more information from or screenshots let me know.
Also this is a Direct Query from a Data Cube (Analysis Services). Not Import.
Solved! Go to Solution.
Solved!
No of Sessions =
VAR _encounters =
CALCULATE (
[Amount],
FILTER (
ALL ( 'Profitability Account' ),
'Profitability Account'[Description] = "Encounters"
)
)
VAR _NoOfDays = Calculate(DISTINCTCOUNT('Time'[CalendarDate]),Filter ('Time', 'Time'[DayOfWeekdayDescription] <> "Sunday" && 'Time'[DayOfWeekdayDescription] <> "Saturday" ))
VAR _NoOfSession = _NoOfDays * SWITCH (
TRUE (),
_encounters <= 2, 0,
_encounters >= 2
&& _encounters <= 10, 1,
_encounters > 10, 2
)
RETURN _NoOfSession
Solved!
No of Sessions =
VAR _encounters =
CALCULATE (
[Amount],
FILTER (
ALL ( 'Profitability Account' ),
'Profitability Account'[Description] = "Encounters"
)
)
VAR _NoOfDays = Calculate(DISTINCTCOUNT('Time'[CalendarDate]),Filter ('Time', 'Time'[DayOfWeekdayDescription] <> "Sunday" && 'Time'[DayOfWeekdayDescription] <> "Saturday" ))
VAR _NoOfSession = _NoOfDays * SWITCH (
TRUE (),
_encounters <= 2, 0,
_encounters >= 2
&& _encounters <= 10, 1,
_encounters > 10, 2
)
RETURN _NoOfSession
Hi, @sabilahmed
Is the condition of the SWITCH function coincident?
No of Sessions =
VAR _encounters =
Calculate(DISTINCTCOUNT('Transaction Attributes'[Encounter Number__EBM__Encounter Number]),Filter ('Transaction Attributes', 'Base Measures'[Charges]>0))
RETURN
SWITCH (
TRUE (),
_encounters < 2, 0,
_encounters >= 2
&& _encounters <= 10, 1,
_encounters > 10, 2
)
If you don't solve your problem, can you tell me the desired result, which can be reflected in the screenshot.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
47 | |
26 | |
19 | |
15 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
19 |