Forum Discussion

Aadi's avatar
Aadi
New Member
9 years ago

Count and then running Sum functionality in Power BI

Hi Experts,

 

Need your help here :

 

I have two coloumns "Fiscal Month" and "Ord ID" . My requirement is to take the "count of Org Id" and then Take the running sum of that "count of Org Id". 

 

Count of Org Id is simple by creating a measure "DISTINCTCOUNT (Org Id)" but iam not able to take the running sum on top of this  "DISTINCTCOUNT (Org Id)"  . Please help 

 

Base table :

 

Fiscal MonthOrg Id
1Other
2Other
3Other
4Other
5Other
6Other
7Other
8Other
9Other
10Other
11Other
12

Other

 

 

 

What i need is like below :

 

Fiscal MonthOrg IdDISTINCT COUNT(Org Id)Running Sum
1Other11
2Other12
3Other13
4Other14
5Other15
6Other16
7Other17
8Other18
9Other19
10Other110
11Other111
12Other112

 

For Running sum i have use the below Logic, but this is not giving me the correct result .

 

Count cumulative =
CALCULATE (
DISTINCTCOUNT('Sheet1'[Org Id]),
FILTER (
ALL ( Sheet1 ),
'Sheet1'[Fiscal Month]<= MAX ( 'Sheet1'[Fiscal Month] )
)
)

 

 

Appreciate you response at the earliest .

 

Thanks

2 Replies

  • Vvelarde's avatar
    Vvelarde
    Community Champion

     

    Aadi

     

     

    Hi, use this DAX Measure

     

    RunningCount =
    SUMX (
        FILTER ( ALL ( Table1 ), Table1[Fiscal Month] <= MAX ( Table1[Fiscal Month] ) ),
        DISTINCTCOUNT ( Table1[Org Id] )
    )

     

    Regards

     

    Victor

    Lima - Peru

    • Aadi's avatar
      Aadi
      New Member

      Thanks Victor for your reply.

       

      This is working with Excel datasource but same when i connect to HADOOP iam not getting the desired result. It just gives me the DistinctCount ie Value 1 for all months. :mansad: