Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Can someone help to check what's wrong with below DAX, it's stopped working recently where VAR SA is not returning any values now....
Our requirement is to get the monthly totals for the selected month, year and attribute, would greatly help if there's any other easy way to do this..TIA
MTDPlanValue (Monthly) =
VAR SM =
MONTH ( SELECTEDVALUE ( 'CALENDAR'[CALENDAR_DATE] ) )
VAR SY =
YEAR ( SELECTEDVALUE ( 'CALENDAR'[CALENDAR_DATE] ) )
VAR SA =
SELECTEDVALUE ( 'AttributeInfo'[Attribute] )
RETURN
CALCULATE (
SUM( 'Stg_PPD DailyReporting_Live_V'[DAILY_PLAN_VALUE] ),
FILTER (
ALL ( 'CALENDAR' ),
'CALENDAR'[CALENDAR_MONTH] = SM
&& 'CALENDAR'[CALENDAR_YEAR] = SY
),
FILTER (
ALL ( 'AttributeInfo' ),
'AttributeInfo'[Attribute] = SA
)
)
Hi,
I am not sure how your datamodel looks like, but I assume there are some cases end users select more than two attributes.
If end users keep selecting only one year and only one month, but selecting more than two attributes, and if this is considered as a correct behavior, please try the below.
MTDPlanValue (Monthly) =
VAR SM =
MONTH ( SELECTEDVALUE ( 'CALENDAR'[CALENDAR_DATE] ) )
VAR SY =
YEAR ( SELECTEDVALUE ( 'CALENDAR'[CALENDAR_DATE] ) )
VAR SA =
VALUES ( 'AttributeInfo'[Attribute] )
RETURN
CALCULATE (
SUM ( 'Stg_PPD DailyReporting_Live_V'[DAILY_PLAN_VALUE] ),
FILTER (
ALL ( 'CALENDAR' ),
'CALENDAR'[CALENDAR_MONTH] = SM
&& 'CALENDAR'[CALENDAR_YEAR] = SY
),
FILTER ( ALL ( 'AttributeInfo' ), 'AttributeInfo'[Attribute] IN SA )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
@Jihwan_Kim , users will select one year/month and attribute only...i have tried below simple DAX and it's not returning any value, what could be wrong here, any ideas.. TIA
Hi,
It is difficult for me to tell what is going on without seeing your pbix file.
Please try the below measure whether it is returning one value or not.
Checking: =
VAR SA =
VALUES ( 'AttributeInfo'[Attribute] )
RETURN
CONCATENATEX ( SA, 'AttributeInfo'[Attribute], ", " )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question
Hi,
If your Year and Month slicer are from the Calendar table, then this simple measure should work
=SUM( 'Stg_PPD DailyReporting_Live_V'[DAILY_PLAN_VALUE] )
Hope this helps.
@Ashish_Mathur , this measure should always give the Monthly total (for selected month, year and attribute) not the day total.
I am still very confused about what you want. Try this measure
Measure = calculate(SUM( 'Stg_PPD DailyReporting_Live_V'[DAILY_PLAN_VALUE] ),datesbetween(calendar[date],eomoth(min(calendar[date]),-1)+1,eomoth(min(calendar[date]),0))
User | Count |
---|---|
83 | |
82 | |
66 | |
52 | |
46 |
User | Count |
---|---|
100 | |
49 | |
42 | |
39 | |
39 |