cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tim10
Helper I
Helper I

Measure only works if argument is included in table

Hello

 

I have a measure with this code:

 

CY-0 InnNS NEW =
var selection=SELECTEDVALUE('Year Filter Table'[Year Filter])
var option1=calculate([_CY_0_InnNS],FILTER('ION_ByProject_2020_2021', OR (Year('ION_ByProject_2020_2021'[Period])=2021 && selection=2021, Year('ION_ByProject_2020_2021'[Period])=2020 && selection=2020)))

var option2=calculate([_CY_1_InnNS],FILTER('ION_ByProject_2020_2021', (Year('ION_ByProject_2020_2021'[Period])=2020 && selection=2020)))
return
option1+option2

 

If i put this in a table, it only works if column Period is included. 

 

01.png

If i remove the period column, the table displays nothing. 

 

02.png

 

Is there a way to fix this? Basically i do not want the period column in the table, just Project Name and the Measure.

 

Thank you

1 ACCEPTED SOLUTION

Try adding the all function to see if it works:

FILTER(ALL('ION_ByProject_2020_2021'),XXXXXXXXXXXXXXXXXX

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @tim10 ,

 

Unfortunately,not clear about your model. Any chance you can share a PBIX file with dummy data?

Please remove any sensitive data before uploading.

https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-... 

 

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

 

Hello, Thank you for your reply. I will not be able to provide sample data unfortunately. 

Try adding the all function to see if it works:

FILTER(ALL('ION_ByProject_2020_2021'),XXXXXXXXXXXXXXXXXX

View solution in original post

this appears to solve my issue. thank you for your support

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.