Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kevball2
New Member

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")

 

1 ACCEPTED SOLUTION
technolog
Super User
Super User

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.

View solution in original post

2 REPLIES 2
technolog
Super User
Super User

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.

CheenuSing
Community Champion
Community Champion

Hi @kevball2

 

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

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors