I would like to filter all Act values from Cost elemt 2 (which is Salaries and Social charges), except Indemnities / Exceptional costs (as underlined in red)
Hi @Greg, thanks for the heads-up! will keep all this in mind going forward.
Find attached a sample pbix file I came up with after watching @BrianJ tutorial on YouTube (thanks Brian for putting this together).
So for My Act figures (have it also for Fct and Bgt, in other tables that have been removed to make the file thinner) I would like to be able to isolate my “pure” Salary costs - excluding Indemnities.
My Q is, how can I use my Act measure to group all values under Cost element’[Cost elemt L2 (Description)] = Salaries and Social charges, excluding Indemnities / Exceptional costs
In your file, you can try out the formula for Salaries and since you want to include all items from the “Salaries and Social Charges” except “Indemnities / Exceptional costs”. Below is the formula provided for the reference -
The reason why it’s giving you can error for this formula is because you’re referencing entire table everytime in the every line of the measure rather than referencing only the column. And therefore it gives an error. See the screenshot provided below for the reference where I’ve also replicated the same scenario in my file as well.
But once we remove that table reference from the measure and we refer only particular column from that table than there won’t be any error. Below is the screenshot provided for the reference -
Or you can upload the revised PBIX file with the measures working in it.
Hoping you find this useful and meets your requirements that you’ve been looking for.
I’m glad that I was able to assist you and you found it helpful.
Another very important thing that you can note in this type of problems is that, when you reference the same columns i.e. in this case you were referencing one single column from a particular table. So in situation like this depending upon your requirement you can use “||” or “&&” condition without using “FILTER” function. But when you start referencing multiple columns you cannot use “&&” condition simply than in that case you’ll be compelled to wrap the conditions inside the “FILTER( ALLSELECTED() )” or “FILTER( ALL() )” depending upon the requirement to achieve the end results.
Conclusion:So you need to use FILTER function when multiple columns are referenced as a condition since CALCULATE function cannot evaluate the results as a TRUE/FALSE expression. And also when you use measure as reference for conditions than in that case as well you’ll be required to use FILTER function since we cannot use the measures directly and place them under the FILTER condition as an arguement .
Hoping this will be helpful to you for your future requirements.
@Greg - thanks for your reply. My apologies, somehow I forgot to update the (Base) Actuals code which led all formulas to error. Please find attached amended PBIX.
Meanwhile I was working I realized that Salaries code, doesn’t work if Cost elemt 2 (Description) is not selecting Salaries and Social charges - ie. it takes everything but Indemnities.
I created a copy of the Calendar table, Date table, to try replicate this analysis recently posted from SQLBI without much success - ie. totals not disaggregated but showing in one shot as per month selected. This might be needed to post it into another thread.
OpEx Act P6M =
VAR _NumOfMonths = 6
VAR _StartDate = MAX( 'Calendar'[Date] )
VAR _PriorDate =
DATESINPERIOD(
'Dates'[Date],
_StartDate,
-_NumOfMonths,
MONTH
)
VAR _Result=
CALCULATE(
[Act],
REMOVEFILTERS( 'Calendar' ),
KEEPFILTERS( _PriorDate ),
USERELATIONSHIP( 'Calendar'[Date], Dates[Date] )
)
RETURN
_Result
Hi @SamSPAIN. You’re posting to a solved thread … for maximum visibility, please create a new thread with a new question. Also, it’s not clear what your issue is (" … how to accomplish this best …"): could you please elaborate on exactly what’s currently happening and exactly what is your desired outcome (and upload an Excel mock-up of the desired outcome) for the forum members to review?
Greg