Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi! I am struggling to figure this out and would appreciate some help.
I am trying to make a PowerBi report that shows "Which country did people vist before they came to their current country". The user of the dashboard would typically select a country and see the previous country visited. The end product should be able to show all previous countries visited but as a starter the previous country would suffice.
I can easily build this for each person, but I am struggling to create an aggregated view. E.g., when I select Germany I can see that 500, 300 and 250 people visited France, UK and USA before visiting Germany.
Any tips?
Solved! Go to Solution.
this was a pretty tough one for me thanks for that was fun
created calculated column
VisitOrder = COUNTROWS
(
FILTER(countryvisits;EARLIER(countryvisits[Person])= countryvisits[Person] && EARLIER(countryvisits[DateCol])>countryvisits[DateCol])
)
+1
created second calculated column
LastCountry = CONCATENATEX
(
FILTER(countryvisits;EARLIER(countryvisits[Person])=countryvisits[Person]&&EARLIER(countryvisits[VisitOrder])-1 = countryvisits[VisitOrder])
;countryvisits[Country]
)
result
Hi @sse,
You can try to use below formula to get the result table if it suitable for your requirement.
Table formula:
Person Country Records = ADDCOLUMNS( SUMMARIZE(Table,[Person],"Country",LASTNONBLANK(Table[Country],[Country]),"Last Timestamp",LASTTimestamp(Table[Timestamp])), "Previous",LOOKUPVALUE(Table[Country],[Person],[Person],[Timestamp],MAXX(FILTER(ALL(Table),[Person]=EARLIER([Person])&&[Timestamp]<EARLIER([Last Timestamp])),[Timestamp])) )
Regards,
Xiaoxin Sheng
Hi @sse,
You can try to use below formula to get the result table if it suitable for your requirement.
Table formula:
Person Country Records = ADDCOLUMNS( SUMMARIZE(Table,[Person],"Country",LASTNONBLANK(Table[Country],[Country]),"Last Timestamp",LASTTimestamp(Table[Timestamp])), "Previous",LOOKUPVALUE(Table[Country],[Person],[Person],[Timestamp],MAXX(FILTER(ALL(Table),[Person]=EARLIER([Person])&&[Timestamp]<EARLIER([Last Timestamp])),[Timestamp])) )
Regards,
Xiaoxin Sheng
this was a pretty tough one for me thanks for that was fun
created calculated column
VisitOrder = COUNTROWS
(
FILTER(countryvisits;EARLIER(countryvisits[Person])= countryvisits[Person] && EARLIER(countryvisits[DateCol])>countryvisits[DateCol])
)
+1
created second calculated column
LastCountry = CONCATENATEX
(
FILTER(countryvisits;EARLIER(countryvisits[Person])=countryvisits[Person]&&EARLIER(countryvisits[VisitOrder])-1 = countryvisits[VisitOrder])
;countryvisits[Country]
)
result
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
109 | |
99 | |
96 | |
38 | |
36 |
User | Count |
---|---|
151 | |
125 | |
75 | |
74 | |
53 |