Forum Discussion

kevball2's avatar
kevball2
New Member
9 years ago
Solved

Using filter or Calculate to find single value

Hi All, 

 

Trying to create a measured value from a csv file 

ProjectLicenseCount = CALCULATE(COUNT(LicenseSummary[Effective Quantity]), LicenseSummary[License Product Family] = "Project Professional ")

 

Trying to get the effective Quantity count for just the project Licenses but the measured value always comes back without and distinct values. There is only 1 row for project professional so there should be no issue with duplicates

 

is there an easier way to get this value? i want to add to as the max value filter for a Gauge Visual

 

I also tried a Lookupvalue with no luck 

 

ProjectLicenseCount = LOOKUPVALUE(LicenseSummary[Effective Quantity], [License Product Family], "Project Professional")

 

  • Your approach to get the "Effective Quantity" for a specific "License Product Family" using DAX in Power BI seems correct. However, there are a few things that could be causing the issue:

    Data Issues: Before diving deep into formulas, always ensure the data quality. Check if there's any leading or trailing white space in the "License Product Family" column values or any hidden characters. Simple errors like this can cause formulas to not match values as expected.

    Formula Issues:

    a. CALCULATE function recalculates an expression over a given filter. It might not give the expected result if other hidden filters are in place. In Power BI, the default behavior is to apply filters from visuals, slicers, and other measures. To clear other filters, you can use the ALL function.

    ProjectLicenseCount = CALCULATE(
    COUNT(LicenseSummary[Effective Quantity]),
    LicenseSummary[License Product Family] = "Project Professional",
    ALL(LicenseSummary)
    )

     

     


    b. LOOKUPVALUE function returns a single value from a column by searching for it in another column. If there are multiple matching values, it can throw an error. It's best to use this function when you are certain there's only one match.


    Visualization Filters: Ensure that there aren't any filters applied at the visual, page, or report level that might be altering your results.

    Data Model Relationships: Ensure that the relationships in your data model are set up correctly. Incorrect relationships can lead to unexpected filter behavior.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kevball2

     

    Can you share some data and sample output expected. Post it in OneDrive and provide the link

     

    Cheers

     

    CheenuSing

  • Your approach to get the "Effective Quantity" for a specific "License Product Family" using DAX in Power BI seems correct. However, there are a few things that could be causing the issue:

    Data Issues: Before diving deep into formulas, always ensure the data quality. Check if there's any leading or trailing white space in the "License Product Family" column values or any hidden characters. Simple errors like this can cause formulas to not match values as expected.

    Formula Issues:

    a. CALCULATE function recalculates an expression over a given filter. It might not give the expected result if other hidden filters are in place. In Power BI, the default behavior is to apply filters from visuals, slicers, and other measures. To clear other filters, you can use the ALL function.

    ProjectLicenseCount = CALCULATE(
    COUNT(LicenseSummary[Effective Quantity]),
    LicenseSummary[License Product Family] = "Project Professional",
    ALL(LicenseSummary)
    )

     

     


    b. LOOKUPVALUE function returns a single value from a column by searching for it in another column. If there are multiple matching values, it can throw an error. It's best to use this function when you are certain there's only one match.


    Visualization Filters: Ensure that there aren't any filters applied at the visual, page, or report level that might be altering your results.

    Data Model Relationships: Ensure that the relationships in your data model are set up correctly. Incorrect relationships can lead to unexpected filter behavior.