Forum Discussion

Jack-B-Quick's avatar
Jack-B-Quick
Frequent Visitor
7 years ago
Solved

Inverse Cumulative Frequency

New to BI and just getting my feet wet.   I have the following summary table below based on some backgroud data ('SampleLicCnts' table). The Frequency column was simple of course, just set the valu...
  • Cmcmahan's avatar
    Cmcmahan
    7 years ago

    I see what you mean about the data shifting.  For this solution, I'm assuming that your Lic value can be sorted in your data and isn't just a random key.  If so, you'll likely need to create the Bin column again, just to keep it sortable.

     

    First, I changed the Cumulative Frequency measure to this expression:

    Cumulative count = if(HASONEVALUE(Data[LicCnt]),COUNTAX(FILTER(ALL(Data),Data[LicCnt]<=SELECTEDVALUE(Data[LicCnt])),[Count]),BLANK())

    Then I set the Inverse Cumulative Frequency measure to this:

    Measure1 = SUMX(FILTER(SUMMARIZE(ALL(Data),Data[LicCnt],"Cumulative Count",[Cumulative count]),[LicCnt]>=SELECTEDVALUE(Data[LicCnt])),[Cumulative count])

    What this is doing is creating a virtual table where it appends the Cumulative Count to the LicCnt, and then rolls that up to a single table that looks like this:

    Then it sums the values from this virtual table where the LicCnt is greater than the current value.  This keeps the count when things are re-ordered via sorting, but relies on you being able to sort by LicCnt.