Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Countifs in PowerBI

Hello 

 

I have a formula in Excel's Power Query:
=COUNTIFS(Append1!$BF:$BF,">=01/01/2020",Append1!$BF:$BF,"<18/11/2022",Append1!$D:$D,"<>24 Application withdrawn")

I wish to convert it into the formula in PowerBI's Power Query.

Please advise as I find the DAX language in PB is really confusing.


4 Replies

  • With DAX, you create a measure like this:

    Count :=
    COUNTROWS(    
        FILTER(
            Append1,
            Append1[Column]>=DATE(2020,1,1)
                &&Append1[Column]<DATE(2020,11,18)
        )
    )
     
    BTW, Power Query uses another language call M language and it is different from DAX.
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you.  I tried the syntax and it worked but there is a red highlight/column in the slider on the right of the formula bar.

      What does it indicate?  I think there is an error somewhere in the syntax but it calculated and produced the correct result.

      I am puzzled.


  • Anonymous's avatar
    Anonymous
    Not applicable

    Here is my syntax and the photo showing the red highlight is attached:

    Start_on_site =
    COUNTROWS(    
        FILTER(
            'Weekly Report Template',
            'Weekly Report Template'[Caseworker Start on Site Date]>=DATE(2020,1,1)
                &&'Weekly Report Template'[Caseworker Start on Site Date]<DATE(2022,11,18)
        ))