Forum Discussion
Calculate Not working
- Anonymous2 years ago
Hi,Anonymous .Hello,Greg_Deckler,thanks for your concern about this issue.
And I would like to share some additional solutions below
I am glad to help you
There seems to be an error in your dax code, you can try this measure:M_result = VAR _onlyactive = CALCULATE(COUNT ( Risk[Project ID]), FILTER( 'Risk',Risk[pmotest_riskstatus] = "646440000" && Risk[pmotest_riskstatus_display] = "Active")) RETURN _onlyactiveIn the calculate () function, the expression to be evaluated should not use variables as much as possible.
here is my test resultI hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, 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.
Hi Greg, thanks for sharing the useful links.
Sample data:
Risk Table:
| Project ID | msdyn_projectriskid | pmotest_riskstatus_display | pmotest_riskstatus |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 956b3f32-4fa7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | f01f3d1f-4fa7-ee11-a568-002248b17b71 | Active | 646440000 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 1ab63111-4fa7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 3dbd91f8-4ea7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | b7e580e0-4ea7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 1f09d039-3fa7-ee11-a568-002248b17b71 | Active | 646440000 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 5e78bf8f-3ea7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | b4621283-3ea7-ee11-a568-002248b17b71 | Closed | 646440002 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | b1b6d442-3ea7-ee11-a568-002248b17b71 | Closed | 646440002 |
The Project ID comes from Project Table and it is 1: Many relationship between Projects:Risks.
On my visual I have the Project ID (or Project Name) slicer and what I expect is that the card visual should show only the Risks that have "pmotest_riskstatus_display" = "Active".
| Project ID | msdyn_projectriskid | pmotest_riskstatus_display | pmotest_riskstatus |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | f01f3d1f-4fa7-ee11-a568-002248b17b71 | Active | 646440000 |
| 73ae842e-dbab-41c8-b20d-360e6c6cbaf9 | 1f09d039-3fa7-ee11-a568-002248b17b71 | Active | 646440000 |