Forum Discussion

afbraga66's avatar
afbraga66
Helper III
4 years ago
Solved

Filtering a constant value

Hello, I am new to Power BI, so my question is that why this measure example returns 3 rows in a table, while I expected it to return only 1 row. I do not understand how to filter constant values....
  • v-yalanwu-msft's avatar
    4 years ago

    Hi, afbraga66 ,
    According to offical document, CALCULATE(<expression>[, <filter1> [, <filter2> [, …]]])

    https://docs.microsoft.com/en-us/dax/calculate-function-dax


    Calculate ([column]) or average or count... as 1 is a constant.so we could change it to:

     

     

    Measure = IF(MAX('Dim_PLANT'[Plant_Code])="P058",1)

     

     

    The final show:

    Or 

     

     

    Measure 2 = CALCULATE(COUNT(Dim_PLANT[Plant_Code]),FILTER('Dim_PLANT',[Plant_Code]="P058"))

     

     

    The final show:


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