Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Need Urgent help

Hi, I want to create a histogram in power BI which will show count of user ids per their Sum of total revenue.

 

The thing is that I have to group the revenue like: 0-50 GBP, 51-100 GBP,101-150 GBP till 500.

I have to show count of user ids per every group . Please see the attached screenshot.

I am unable to do that as it will vary after selecting values in different slicers like Market, Country, Month etc.

 

I can show sum of revenue but for the group I have to create a meaasure which I did but unable to add gthat measrue in y axis.

 

Please help me.

 

  • Anonymous 

    if this is what you want : 

     

     

    then just modify the code to this : 

    Measure 9 = 
    var lowerbound = MIN(Segment_table[Min])
    var upperbound =  MAX(Segment_table[max])
    
    var ds = 
    FILTER(
       
            VALUES(Sheet1[UUID]),
      
        [Total Revenue] >= lowerbound && [Total Revenue]< upperbound
    )
    
    
    return COUNTROWS(ds)

     

     

    let me know if this works. 

     

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

12 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Please review the attached 2 screenshots

      One screenshot is from my power BI file and second screenshot is from the video which is showing the dax.

       

      . If I select UUID(user id) then in the bar chart it is showing 3 different bars . As the total Revenue is 433.98(see table view), the bar of bar chart should only show 1 bar which comes under 400 - 450 GBP.

      All other slicers are showing the correcct value. 

      This UUID slicer is not required but if I do deep analysis then I am facing this concern

      I am stuck here. I already made the calculation but with a diffrent way. In the video they have shown me a shortcut.

      This is the dax that I have written after watching the video:

      Group Revenue =
       
      CALCULATE(COUNTROWS(act_orders),FILTER(act_orders,NOT(ISEMPTY(FILTER(Segment,NOT(ISBLANK([Total Revenue])) && Segment[Min]<[Total Revenue] && Segment[Max]>=[Total Revenue])))))
       
      In the video they are not facing this multiple bars concern but I am facing.
      I beg you pls help me.
       

       

       

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    Anonymous 

    sample data used in my example : 

     

    output  : 

     

     

     

    table names :  dataa , groups 

    steps :

    create table groups as follow : 

     

     

     

    now create the following measure : 

    Measure 9 = 
    var lowerbound = MIN(groups[lower])
    var upperbound =  MAX(groups[upper])
    
    var ds = 
    FILTER(
        dataa,
        CALCULATE(sum(dataa[revenue])) >= lowerbound && CALCULATE(SUM(dataa[revenue])< upperbound)
    )
    
    
    return COUNTROWS(ds)

     

     

     

    let me know if this helps.

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Daniel29195 . No its not working. I am uploading the sample data. Please check mine

  • Anonymous's avatar
    Anonymous
    Not applicable

    omgggggggggg. Its working . Many thanks

     

    I was trying to fix this since a month but you solved it in half an hour. 

     

    May I know from where I can learn to use dax functions in advanced level. Like in my scenario you have fixed it quickly ?