Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Experts,
I need your help. I would like to create a measure to get the last checked-in value for each day. The data model and expected output is shown below. Please help
Thanks
Solved! Go to Solution.
Hi @Anonymous ,
You may keep the Cross filter direction of relationships between the tables above in Both, then you can create measure like DAX below.
Measure =
Var d=CALCULATE(MAX('Fact_Tourist arrived'[TimeKey]),ALLEXCEPT('Fact_Tourist arrived','Fact_Tourist arrived'[Hotel Key],'Fact_Tourist arrived'[DateKey]))
Return
CALCULATE(SUM('Fact_Tourist arrived'[No. of Tourist arrived]),FILTER(ALLSELECTED('Fact_Tourist arrived'),'Fact_Tourist arrived'[TimeKey]=d&&'Fact_Tourist arrived'[Hotel Key]=MAX('Fact_Tourist arrived'[Hotel Key])&&'Fact_Tourist arrived'[DateKey]=MAX('Fact_Tourist arrived'[DateKey])))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You may keep the Cross filter direction of relationships between the tables above in Both, then you can create measure like DAX below.
Measure =
Var d=CALCULATE(MAX('Fact_Tourist arrived'[TimeKey]),ALLEXCEPT('Fact_Tourist arrived','Fact_Tourist arrived'[Hotel Key],'Fact_Tourist arrived'[DateKey]))
Return
CALCULATE(SUM('Fact_Tourist arrived'[No. of Tourist arrived]),FILTER(ALLSELECTED('Fact_Tourist arrived'),'Fact_Tourist arrived'[TimeKey]=d&&'Fact_Tourist arrived'[Hotel Key]=MAX('Fact_Tourist arrived'[Hotel Key])&&'Fact_Tourist arrived'[DateKey]=MAX('Fact_Tourist arrived'[DateKey])))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
Try like
Measure =
VAR __id = MIN ( 'Table'[Datetime] )
VAR __date = CALCULATE ( MIN( 'Table'[Datetime] ), ALLSELECTED ( 'Table' ), 'Table'[hotelname] = __id )
RETURN CALCULATE ( sum ( 'Table'[tourist arrived] ), VALUES ( 'Table'[hotelname] ),values('Date'[Date]), 'Table'[hotelname] = __id, 'Table'[Datetime] = __date )
If does not work share some sample data
Hi @Anonymous
Try this,
Measure =
VAR __maxTime =
GROUPBY(
'Table',
'Hotel'[Hotel Name],
'Date'[Date],
"@maxTime", MAXX( CURRENTGROUP(), 'Table'[Time] )
)
RETURN
CALCULATE(
SUM( 'Table'[No of Tourist ] ),
TREATAS( __maxTime, 'Hotel'[Hotel Name], 'Date'[Date], 'Table'[Time] )
)
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |