none
Need a Query based on Condition RRS feed

  • Question

  • Hi ,

    I need a DAX query to show the Count of resources whose hours are less than 40

    Here attached the Power BI - "Bar chart" ,In this chart we have 4 resources who is having less than 40 hours,

    i need the output as 4

    How to write the DAX query?

    Thanks,

    R.B


    • Edited by BhupeshR Wednesday, December 16, 2015 12:16 PM
    Wednesday, December 16, 2015 12:15 PM

Answers

  • R.B.

    I'd need to know the tables/columns/measures involved in the bar chart above to be sure, but you're looking for an expression similar to this:

    COUNTROWS(
        FILTER(
            SUMMARIZE(
                YourTable,
                [ResourceName],
                "TotalHours",
                 SUM(YourTable[Hours])
             ),
             [TotalHours]<40
         )
    )

    Wednesday, December 16, 2015 6:47 PM

All replies

  • R.B.

    I'd need to know the tables/columns/measures involved in the bar chart above to be sure, but you're looking for an expression similar to this:

    COUNTROWS(
        FILTER(
            SUMMARIZE(
                YourTable,
                [ResourceName],
                "TotalHours",
                 SUM(YourTable[Hours])
             ),
             [TotalHours]<40
         )
    )

    Wednesday, December 16, 2015 6:47 PM
  • Thanks Taylor for the Solution. It work as required.

    But for the above question , i need to update with some categories like, let us say, i have a filter with "Hours Categories" with range values like 1. "<40 Hours" 2. "between 40 and 50"      3. "Greater than 50"

    so when the user filters above three values ,based on that the count should show.

    For above :<40 have count 4 ,same like i need to get the values for remaining filter values (2. "between 40 and 50"      3. "Greater than 50") respectively.

    How to achieve this in DAX?

    Thanks

    R.B


    • Edited by BhupeshR Thursday, December 17, 2015 9:10 AM
    Thursday, December 17, 2015 6:19 AM