Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

CountA add condition

 

Here is the formula powerBI suggested - How do I condition that only selecting unrealised_value_usd > 0?

 

Basically i wanna return the count of Pure_Project_id where the column unrealised_value_usd >0

 

To be exact

 

I would like to return Count of Project for each project based on how many "Unrealised_Value_USD" that's >0. Obviously the formula I have here is wrong. (the first few Project has the same Name but a different Count of Project)

 

Count of Project =
CALCULATE(
    COUNTA(DIM_Project[PROJECT]),
    ALLSELECTED('FACT_Holdings'[UNREALIZED_VALUE_USD] )
)

 

Thanks. 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Here some steps that I want to share, you can check them if they suitable for your requirement.

    Here is my test data:

    DIM_Project table:

    FACT_Holdings table:

    1.Create measure

     

    Count of Project =
    CALCULATE (
        CALCULATE (
            COUNTA ( DIM_Project[PROJECT] ),
            FILTER ( FACT_Holdings, FACT_Holdings[UNREALIZED_VALUE_USD] > 0 )
        ),
        ALLSELECTED ( 'FACT_Holdings'[UNREALIZED_VALUE_USD] )
    )

     

    2.Final output

    Best regards

    Albert He

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Here some steps that I want to share, you can check them if they suitable for your requirement.

    Here is my test data:

    DIM_Project table:

    FACT_Holdings table:

    1.Create measure

     

    Count of Project =
    CALCULATE (
        CALCULATE (
            COUNTA ( DIM_Project[PROJECT] ),
            FILTER ( FACT_Holdings, FACT_Holdings[UNREALIZED_VALUE_USD] > 0 )
        ),
        ALLSELECTED ( 'FACT_Holdings'[UNREALIZED_VALUE_USD] )
    )

     

    2.Final output

    Best regards

    Albert He

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly