Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Apply data segmentation to a cumulative count

Hello

I'm trying to apply a segmentation of data through a visual that respects this DAX filter

S/d acumulado á calculate('Checkin-Chekout'[Tipe]),

filter(all('Checkin-Chekout'),

'Checkin-Chekout'[Fecha .] <'max('Checkin-Chekout'[Fecha .])))
This DAX counts check-in/check-out and aplies a filter that accumulates them by date.
The problem is that when I use the segmentation visual with the 'Checkin-Chekout' column, dosen't show the accumulated count of that hotel by date and that's what I want.
Can someone help me?
Thanks a lot.
  • Anonymous's avatar
    Anonymous
    6 years ago

    @V-pazhen-msftthis only works when I choose a hotel to filter, not what counts everything. However, you have solved here in another thread of mine with the same problem that I unintentionally duplicated.

    But I'm still untrained in how the DAX you wrote in this real thread would fit to show the hole count and not as it did on the blue line

    Thanks a lot!

4 Replies

  • Anonymous , Did not get it completely. But it better to move you Date to date table and have that filter there

    S/d acumulado á calculate([Tipe],
    filter(all('Date'),
    'Date'[Fecha .] <max('Date'[Fecha .])))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
    https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
    https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
    https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 

      Thanks for the answer, but it does not still suits me.

      I've created the table acording to the tutorials you gave me, and the DAX it's now like this:

      Acumulated s/d = CALCULATE(count('Chekin Checkout'[Type]), 

      filter(all('Chekin Checkout'), 'Chekin Checkout'[Type] = "Checkout" ),

      filter (all(Dates), Dates[Date] <= max(Dates[Date])))
      Earlier before I forgot to add a boolean for the "Check out" cases so i've added it above. The Dates Table still does not solves my problem (it is correctly related with Checkin Checkout table).
      My problem is that i want to show the acumulatation of the checkouts globally (i could do this with de DAX above), AND by Hotel with this visual data segmentation by hotel (it is in spanish).
      When i click one of those hotels, it does not show me the checkouts acumulations for that hotel (by date) in my line graph; the global number of checkouts is maintained no matter what hotel i choose.
      e.g. graph line 
       
       
      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous 

        Try add another hotel filter to the dax, something like:

         

        Acumulated s/d = CALCULATE(count('Chekin Checkout'[Type]), 
        
        filter(all('Chekin Checkout'), 'Chekin Checkout'[Type] = "Checkout" ), 
        
        filter (all(Dates), Dates[Date] <= max(Dates[Date])),
        
        Filter(all(Chekin Checkout),sumx(filter(Chekin Checkout,earlier(Chekin Checkout[hotel])=Chekin Checkout[hotel]),1))

         

         

        Paul Zheng _ Community Support Team
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.