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
nsatyabrat7
Helper I
Helper I

dax help

 - hi ,

      I need count of my bidc column where "all units usa" measure is greater than 10.

      I am not able to write measure inside a calculate function as filter.

      =Calculate(count(dac),[all units usa]>10)   ---this is showing error.. even i tried with variable still getting a error.

     any help ?

     Thanks 

8 REPLIES 8
Fowmy
Super User
Super User

@nsatyabrat7 

What is the error and how is the measure [all units usa] constructed?

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

hist units usa:=TRUNC(SUMX(product, product[historical_qty_usa])/[num distinct periods],2)

 [all units usa]  = CALCULATE([hist units usa],FILTER(all('date'[date_key]), 'date'[date_key]=max('date'[date_key])))

 

Now i want to create a measure like 

[usa sku count] =  calculate(count(product[sku]), [all units usa] >1)

error msg - 

A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

hope i am able to clear you the requirement.

Hi @nsatyabrat7 ,

 

 

Share sample data if you can.

 

else try

 

[usa sku count] =
VAR _allunitsusa = [all units usa]
RETURN
    COUNTX (
        FILTER (
            'Product',
            _allunitsusa > 1
        ),
        Product[Sku]
    )

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Anonymous
Not applicable

Hi @nsatyabrat7 

You can't use a measure inside a boolean expression that is used as filter expression. There are certain rules related to this

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

Apart from this your measure [usa sku count] =  calculate(count(product[sku]), [all units usa] >1) doesn't refer any column which needs to be filtered.

 

 

 

 

 

hi, i understand those rules about calculate function..but i am looking for a help or work around.

Anonymous
Not applicable

Hi @nsatyabrat7 can you share some sample data along with expected output and a clear description of the problem. Maybe then I can help you.

 

Thanks  

Greg_Deckler
Super User
Super User

@nsatyabrat7 -

 

Try something like:

 

Measure = COUNTX(FILTER('Table'[all units usa] > 10),[dac])

or

Measure = CALCULATE(COUNT('Table'[dac]),FILTER('Table'[all units usa] > 10))

 

If that does not help, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

no..its not working...

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