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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RT5
Regular Visitor

calculate sum of Active Cases ignoring Axis

Hello Community!

 

Have a question, how to calculate sum of Active Cases ignoring Axis.

So basically in one column chart there should be number of cases per type and sum of all Active cases until each date.

I tried to use the following DAX:

 

Active Cases SUM =

var Active_Num =
COUNTROWS(FILTER('Incident Fact','Incident Fact'[statecodename] = "Active"))
RETURN
Calculate(Active_Num, All())

But i get something like that, basically the blue chart should show the total of all Active cases until the particular date:

 

RT5_1-1647539981924.png

However i need the following results:

RT5_0-1647539837535.png

 

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

I think i found the solution with the DAX below:

Active Cases Sum =
CALCULATE(
[Active Cases],
FILTER(
ALL( 'incident Fact' ),
'Incident Fact'[CreatedOn_Date] <= MAX( 'Incident Fact'[CreatedOn_Date])
)

View solution in original post

6 REPLIES 6
RT5
Regular Visitor

You can find the expected result below:

RT5_0-1647605041357.png

 

dummy sample could be following:

 

Case numberCasetypeDate
1Active01.02.2022
2Resolved02.02.2022
3Canceled03.02.2022
4Active01.02.2022
5Resolved02.02.2022
6Canceled03.02.2022
7Active01.02.2022
8Resolved02.02.2022
9Canceled03.02.2022
10Active01.02.2022
11Resolved02.02.2022
12Canceled03.02.2022
13Active 04.02.2022
14Resolved05.02.2022
15Canceled04.02.2022
16Resolved05.02.2022
17Canceled04.02.2022
18Active05.02.2022

 

Cheers

RT

I don't see how to get from the sample data to the expected outcome. There seem to be a couple of columns missing in the sample data?

I think i found the solution with the DAX below:

Active Cases Sum =
CALCULATE(
[Active Cases],
FILTER(
ALL( 'incident Fact' ),
'Incident Fact'[CreatedOn_Date] <= MAX( 'Incident Fact'[CreatedOn_Date])
)
RT5
Regular Visitor

Hello Ibdendlin,

 

do you have an idea how it can be adjusted?

 

Regards,

RT

Please provide sanitized sample data that fully covers your issue.

Please show the expected outcome based on the sample data you provided.

lbendlin
Super User
Super User

"chart should show the total of all Active cases until the particular date"

 

You may want to adjust your measure to make it cumulative.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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