Help req'd with simple DAX measure

tbablue

Active Member
Joined
Apr 29, 2007
Messages
488
Office Version
  1. 365
Platform
  1. Windows
Hi forum,

Long time user of Excel board - first time posting about DAX

I need a DAX measure that will sum the values of 'Reporting_Data'[Hours] for all the corresponding values of 'Reporting_Data'[Period] that equal another measure that I've created called 'Largest Period Before Today (Unaffected by Slicers)'.

I appreciate that this may be straightforward - but I'm a noob at DAX.

Any help gratefully rec'd.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Can't load PBI to test but it would be something like this, depending on how you other measure looks like.

Excel Formula:
=calculate(sum(reportTable[HoursColumn]),[PeriodColumn] = yourOtherMeasure)
 
Upvote 0
Thanks for your attention.

Your measure seems simpler than mine was.

The DAX I've written based on your advice ...

Current Weekly Hours = CALCULATE(SUM(Reporting_Data[Hours]),Reporting_Data[Period] = [Largest Period Before Today (Unaffected by Slicers)])

...yields me an error message

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

Any ideas?

I suspect the issue is the measure, [Largest Period Before Today (Unaffected by Slicers)]) !?
 
Upvote 0
Yes, that should be a single value. What is the output of that measure? Could you post the measure?
 
Upvote 0
Thanks for your attention.

Your measure seems simpler than mine was.

The DAX I've written based on your advice ...

Current Weekly Hours = CALCULATE(SUM(Reporting_Data[Hours]),Reporting_Data[Period] = [Largest Period Before Today (Unaffected by Slicers)])

...yields me an error message

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

Any ideas?

I suspect the issue is the measure, [Largest Period Before Today (Unaffected by Slicers)]) !?
This was my measure ... it ran ... but did
Yes, that should be a single value. What is the output of that measure? Could you post the measure?
Yes, that should be a single value. What is the output of that measure? Could you post the measure?
This is the measure ...

Largest Period Before Today (Unaffected by Slicers) =
VAR AllPeriods = ALL('Reporting_Data'[Period])
VAR Today = TODAY()
RETURN
CALCULATE(
MAX('Reporting_Data'[Period]),
FILTER(
'Reporting_Data',
'Reporting_Data'[Period] <= Today
&& CONTAINS(AllPeriods, 'Reporting_Data'[Period], 'Reporting_Data'[Period])
)
)
 
Upvote 0
What if you write your largest period measure like this;

Excel Formula:
=CALCULATE(
   MAX('Reporting_Data'[Period]),
      ALL('Reporting_Data'[Period]),
     'Reporting_Data'[Period] <= today()
 )
 
Upvote 0
Your DAX is definitely simpler (which I obviously prefer) but it still yields the same error message in my other piece of DAX.

I think perhaps I need to try something different.
 
Upvote 0
Really hard to tell without the file or data... maybe you can post some sample data and desired outputs
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top