Forum Discussion
PAVITHRA_R_G
2 years agoRegular Visitor
Query on slicer
Hello , I have a query. Im having a table with patient id, enrolled from date, activated from date and dropped from date . I want a column which calculate the patient status as enrolled, active and ...
- Anonymous2 years ago
Hi PAVITHRA_R_G ,
Here are the steps you can follow:
1. Create calculated table.
Date = CALENDAR( DATE(2023,1,1), DATE(2024,12,31))2. Enter data – create a group table.
3. Create measure.
Measure = var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date]) var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date]) var _column= SELECTCOLUMNS(FILTER(ALL('Date'),'Date'[Date]>=_mindate&&'Date'[Date]<=_maxdate),"test",[Date]) return SWITCH( TRUE(), MAX('Table'[Activated from]) in _column && MAX('Table'[Dropped from]) in _column,"dropped", MAX('Table'[Enrolled from]) in _column && MAX('Table'[Activated from]) in _column,"active", MAX('Table'[Enrolled from]) = MAX('Table'[Activated from]) ,"active")Measure 2 = COUNTX( FILTER(ALL('Table'), [Measure]=MAX('Group_Table'[Group])),[Person ID])4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
2 years agoNot applicable
Hi PAVITHRA_R_G ,
Here are the steps you can follow:
1. Create calculated table.
Date =
CALENDAR(
DATE(2023,1,1),
DATE(2024,12,31))
2. Enter data – create a group table.
3. Create measure.
Measure =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
var _column=
SELECTCOLUMNS(FILTER(ALL('Date'),'Date'[Date]>=_mindate&&'Date'[Date]<=_maxdate),"test",[Date])
return
SWITCH(
TRUE(),
MAX('Table'[Activated from]) in _column && MAX('Table'[Dropped from]) in _column,"dropped",
MAX('Table'[Enrolled from]) in _column && MAX('Table'[Activated from]) in _column,"active",
MAX('Table'[Enrolled from]) = MAX('Table'[Activated from]) ,"active")Measure 2 =
COUNTX(
FILTER(ALL('Table'),
[Measure]=MAX('Group_Table'[Group])),[Person ID])
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly