Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I think this request is not an easy one, but lets try it.
I have a table that is the result of appending many similar tables, each one with its own Snapshot (which I take with a macro in Excel and then read all the snapshots and append in PBI). The result is a table like the next one. Some days new IDs can appear, some days they will disappear, some days they will remain but change the Status:
table1:
ID | Status | Snapshot Date |
1 | Won | 16/06/2022 |
2 | Won | 16/06/2022 |
3 | Lost | 16/06/2022 |
4 | Lost | 16/06/2022 |
5 | Open | 16/06/2022 |
6 | Open | 16/06/2022 |
1 | Won | 17/06/2022 |
2 | Lost | 17/06/2022 |
4 | Open | 17/06/2022 |
6 | Won | 17/06/2022 |
7 | Lost | 17/06/2022 |
1 | Won | 20/06/2022 |
2 | Won | 20/06/2022 |
3 | Open | 20/06/2022 |
4 | Open | 20/06/2022 |
5 | Lost | 20/06/2022 |
10 | Open | 20/06/2022 |
Once I have this table I make a filter in my dashboard, where you can select 2 dates, and both dates will be compared. This has to be dinamyc, because my first approach was creating columns instead of measures and it didn't work:
For example, in this case I have selected these 2 dates and then I capture them using 2 measures:
Solved! Go to Solution.
@v-mgonzaleza , try these measures
Same Status on both Dates = //slicer date can be from Table too , I assumed date table
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), _minst = _maxst && not(isblank(_minst)) && not(isblank(_maxst)) ), [ID])
Diff Status on both Dates = //slicer date can be from Table too , I assumed date table
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), _minst <> _maxst && not(isblank(_minst)) && not(isblank(_maxst)) ), [ID])
new on max =
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), (isblank(_minst)) && not(isblank(_maxst)) ), [ID])
same as this blog, you are just using one date range
Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
@v-mgonzaleza , try these measures
Same Status on both Dates = //slicer date can be from Table too , I assumed date table
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), _minst = _maxst && not(isblank(_minst)) && not(isblank(_maxst)) ), [ID])
Diff Status on both Dates = //slicer date can be from Table too , I assumed date table
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), _minst <> _maxst && not(isblank(_minst)) && not(isblank(_maxst)) ), [ID])
new on max =
var _max = minx(allselected(Date), Date[Date])
var _min = maxx(allselected(Date), Date[Date])
var _minst =calculate(Max(Table[Status], Filter(Table,Table[Date] =_min ) )
var _maxst = calculate(Max(Table[Status], Filter(Table,Table[Date] =_max ) )
return
countx(filter(Values(Table[ID]), (isblank(_minst)) && not(isblank(_maxst)) ), [ID])
same as this blog, you are just using one date range
Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |