Forum Discussion

Marecki's avatar
Marecki
New Member
1 year ago

DAX Calulate columns problem

Hello,

 

I'm brand new to Power BI and still learning about DAX and creating advanced models. I have a small problem. I have a model called Test, and I created two DAX measures. When I use them separately in the model, they work fine. Now I want to create a third DAX measure that subtracts noQuantity from yesQuantity, but when I add it to the dashboard, I get an error without any explanation.

 

yesQuantity = 

CALCULATE(
    COUNTROWS('Test'),
    'Test'[isCalculated] = "Yes"
)
 
noQuantity =
CALCULATE(
    COUNTROWS('Test'),
    'Test'[isCalculated] = "No"
)
 

netQuantity = [YesQuantity] - [NoQuantity]

 

 

6 Replies

  • Marecki you should use the exact names of the measures yesQuantity and noQuantity as defined.

    netQuantity = [yesQuantity] - [noQuantity]
    • Marecki's avatar
      Marecki
      New Member

      Ye, of course i put names properly in PowerBI. Sorry for that, my mistake when writing post. 

        

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Marecki 

     

    I did some tests, but unfortunately that I can't reproduce your issue, it works well in my side.

     

    If possible, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    Best Regards

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

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi Marecki ,
    Just wanted to check if you had the opportunity to review the suggestions provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @Marecki ,
    Just wanted to check if you had the opportunity to review the suggestions provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @Marecki ,
    Just wanted to check if you had the opportunity to review the suggestions provided?
    If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank You