The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone,
I'm a new user of Power BI and need your help to solve the problem.
I have a data of customer who have unique identifier and corresponding date field.
I want to create a column of min and max date values. e.g. in this case min (date) would be 1/15/2021 and max(date) 12/1/2021. Just I want these columns of max and min values to be changed depending on slicer filter. Namely, when I mark on slicer dates from 2/23/2021 to 10/25/2021 then column for maximum date should be 8/20/2021 and column for minimum date should be 3/19/2021 for the table above.
I've tried to write function like this but did not work.
maxDateAll= CALCULATE ( MAX ( tbl[date] ), ALLSELECTED(tbl))
How can slicer filter affect not just visualization but also column/table calculations?
Could you please help me to solve this issue?
Thank you in advance
Solved! Go to Solution.
@Nini1 , Ideally these should work from Max and min
maxx(allselected(tbl) , tbl[date])
minx(allselected(tbl) , tbl[date])
But if slicer is on another table try like
maxDateAll=
Var _max = maxx(allselected(Date) , Date[date])
Var _min = minx(allselected(Date) , Date[date])
return
CALCULATE ( MAX ( tbl[date] ), filter(ALLSELECTED(tbl), tbl[date] <= _max && tbl[date] >= _min))
Hi @Nini1 ,
No, it's not possible. Since calculated column is static, it could not be dynamically changed based on the selection in slicer.
For your case, please use the same syntax to create measure instead:
max = CALCULATE(MAX('Table'[date]), ALLSELECTED('Table'))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you, this solved my problem as well that no one on community could answer!
Thank you very much!
@Nini1 , Ideally these should work from Max and min
maxx(allselected(tbl) , tbl[date])
minx(allselected(tbl) , tbl[date])
But if slicer is on another table try like
maxDateAll=
Var _max = maxx(allselected(Date) , Date[date])
Var _min = minx(allselected(Date) , Date[date])
return
CALCULATE ( MAX ( tbl[date] ), filter(ALLSELECTED(tbl), tbl[date] <= _max && tbl[date] >= _min))
Thank you very much!
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |