The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a need to identify IDs in my data who have gone forwards on scoring if interviewed more than once. Set of IDs are evaluated for a Brand and based on responses a scoring value is assigned.
There could be a scenario where some IDs have scored more than what they had scored previously, i.e. I scored 2 in Apr'23 and Aug I scored 3.
All this (DAX Measure) must be responsive to date slicer, so the counting should happen only within the selected date range.
So, to summarize, the requirement is:
1. Identify Ids using a measure that have scored better than what they scored previously (have upgraded). One such case highlighted in the image, should only calculate for cases where an ID has been evaluated more than once
Any suggestion/leads will be greatly appreciated.
Solved! Go to Solution.
try like:
Measure =
VAR _table =
ADDCOLUMNS(
VALUES(data[brand]),
"LastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _lastdate
),
"2ndLastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
VAR _2ndlastdate =
CALCULATE(
MAX(data[date]),
data[date] < _lastdate
)
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _2ndlastdate
)
)
RETURN
COUNTROWS(
FILTER(
_table,
[LastDateScore]>[2ndLastDateScore]
&&[2ndLastDateScore]<>BLANK()
)
)
Changed it to CountX, works alright.
Stupendous work mate, many thanks
hi @AlwaysAGooner ,
Not sure if i fully get you, try to plot a measure like:
Measure =
VAR _table =
ADDCOLUMNS(
VALUES(data[brand]),
"LastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _lastdate
),
"2ndLastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
VAR _2ndlastdate =
CALCULATE(
MAX(data[date]),
data[date] < _lastdate
)
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _2ndlastdate
)
)
VAR _list =
CALCULATETABLE(
VALUES(data[brand]),
FILTER(
_table,
[LastDateScore]>[2ndLastDateScore]
&&[2ndLastDateScore]<>BLANK()
)
)
RETURN CONCATENATEX(_list, data[brand], ", ")
it worked like:
Thanks. I just need the count not the actuals. So while looking at Brand A for Q1 2023, how many picked on their previous scores.
Pls suggest.
try like:
Measure =
VAR _table =
ADDCOLUMNS(
VALUES(data[brand]),
"LastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _lastdate
),
"2ndLastDateScore",
VAR _lastdate = CALCULATE(MAX(data[date]))
VAR _2ndlastdate =
CALCULATE(
MAX(data[date]),
data[date] < _lastdate
)
RETURN
CALCULATE(
MAX(data[score]),
data[date] = _2ndlastdate
)
)
RETURN
COUNTROWS(
FILTER(
_table,
[LastDateScore]>[2ndLastDateScore]
&&[2ndLastDateScore]<>BLANK()
)
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
19 | |
18 | |
16 | |
13 |
User | Count |
---|---|
38 | |
38 | |
23 | |
21 | |
17 |