Forum Discussion

jasemilly's avatar
jasemilly
Helper III
3 years ago
Solved

Dynamically Summarise Fact table to create a histogram showning number of attempts

Hi Everyone After some help, please  I have been banging my head against a wall on this.   I have a table that contains job ID, Date,Communcation method.  this is a table of jobs that have been ...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , jasemilly 

    According to your dax code , you want to get the mcount frequence when it meet the date slicer and the [method]="Manual".

    Here are the steps you can refer to :
    (1)This is my test data and i hope my understand is right:

    (2)We can click "New Table" to create a table like this and we do not need to create any relationship with other tables:

    Table 2 = GENERATESERIES(1,MAXX( SUMMARIZE('Table','Table'[Jobid], "count", CALCULATE( COUNT('Table'[Jobid]) , 'Table'[method] = "Manual")) ,[count]),1)

     

    (3)Then we can create two measures:

    mcount Measure = CALCULATE( COUNT('Table'[Jobid]) , 'Table'[method]="Manual")
    Frequence = var _t = SUMMARIZE( 'Table' ,'Table'[Jobid] ,"mcount" , [mcount Measure])
    var _cur_row = MAX('Table 2'[Value])
    
    return
    COUNTROWS(FILTER(_t , [mcount]=_cur_row) )

    And if you want to show the total you can also create a more measure:

    Frequence Right Total = SUMX(VALUES('Table 2'[Value]) , [Frequence])

     

    Then we can put the measures on the visual and we can get the result is as follows:

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly