The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Type: | Category: | URL_clicks: | Service_requests: | % of service requests: |
Animals | Animal Registration | 39 | 12 | 85.70% |
Animals | Dog Park Enquiry | 12 | 0 | 0% |
Bookings & Events | Venue Booking | 49 | 2 | 14.30% |
Solved! Go to Solution.
Alright, this is a fun question and a big thank you for adding some dummy data so we can try stuff out in Power BI. The first thing we need to do is to create new relationships. The reason for this is that your dimension table (request_types) has multiple columns that can be linked to, that needs to be one. In you sample we could just choose the unique column (e.g. category) but this might not be a unique column in your real data set. To create a unique column in Request_types, let's add an index table to it in the power query editor:
Now every row is numbered uniquely. We just have to add calculated columns to the two other tables. The DAX for this is the following for table Event_clicks
CategoryIndex = LOOKUPVALUE(Request_Types[Index], Request_Types[Category], Event_clicks[Category], Request_Types[Type], Event_clicks[Product])
And for Service_requests:
CategoryIndex = LOOKUPVALUE(Request_Types[Index], Request_Types[Category], Service_requests[Request_category], Request_Types[Type], Service_requests[Request_type])
Now we are going to create relationships as follow:
These are one to many, and now you have a 'normal' datamodel. Now we are going to create a Table visual with the following columns:
Note that the first and second column are from the Request_types table, the third column is from Event_Clicks, the third is a distinct count of Reference column in Service_Request and the measure in the last column has the following DAX:
% of Service Requests = DIVIDE(DISTINCTCOUNT(Service_requests[Reference]), CALCULATE(DISTINCTCOUNT(Service_requests[Reference]), ALLSELECTED(Service_requests)))
My PBIX can be found here for your convience.
Let me know if this answers your question, and if you have any others please let me know 🙂 Kudo's are appreciated.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Alright, this is a fun question and a big thank you for adding some dummy data so we can try stuff out in Power BI. The first thing we need to do is to create new relationships. The reason for this is that your dimension table (request_types) has multiple columns that can be linked to, that needs to be one. In you sample we could just choose the unique column (e.g. category) but this might not be a unique column in your real data set. To create a unique column in Request_types, let's add an index table to it in the power query editor:
Now every row is numbered uniquely. We just have to add calculated columns to the two other tables. The DAX for this is the following for table Event_clicks
CategoryIndex = LOOKUPVALUE(Request_Types[Index], Request_Types[Category], Event_clicks[Category], Request_Types[Type], Event_clicks[Product])
And for Service_requests:
CategoryIndex = LOOKUPVALUE(Request_Types[Index], Request_Types[Category], Service_requests[Request_category], Request_Types[Type], Service_requests[Request_type])
Now we are going to create relationships as follow:
These are one to many, and now you have a 'normal' datamodel. Now we are going to create a Table visual with the following columns:
Note that the first and second column are from the Request_types table, the third column is from Event_Clicks, the third is a distinct count of Reference column in Service_Request and the measure in the last column has the following DAX:
% of Service Requests = DIVIDE(DISTINCTCOUNT(Service_requests[Reference]), CALCULATE(DISTINCTCOUNT(Service_requests[Reference]), ALLSELECTED(Service_requests)))
My PBIX can be found here for your convience.
Let me know if this answers your question, and if you have any others please let me know 🙂 Kudo's are appreciated.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @JarroVGIT,
Thanks for your swift response.
Your suggested solution does fit my requirements. However, in my case, I'm unable to get a distinct count of Reference column even after replicating the suggested solution - quite puzzling given that Event_count does a sum as expected so would not expect that the Count (distinct) is 'broken'. This also affects the measure in the last column, as seen in the screenshot below:
Am I missing something?
Proud to be a Super User!
Hi @DeeGee ,
The problem is in the data type of the date column in service requests table. If you go to Power Query Editor you see this is clear text. Because of the relationship with the calendar table, this will always filter to zero rows when a date (range) is selected in the calendar table.
Because I am on a different locale then you, my dates are written differently. 02/01/2020 means January 2nd in your data set but in my PowerBI (and probably yours as well?) it is February 1st. That means when I convert it to a date column, it will throw a few errors (e.g. 21/07/2019 doesn't excists because there is no 21st month). Fixing the data issue will fix your issue with the filter column 🙂
What I personally learnt from this is that when you select "Select All" in a slicer, it deletes any filters on the column it is slicing, while selecting all options in the dropdown list filters with all possible values. (in your case, selecting Select All removed the filter on the date column, but selecting all months seperately also shows no counts of references).
Anyway, hope this resolves your issue, let me know if you have any furter questions and don't forget to like posts that helped you and mark any posts as the solution if it answered your question(s) 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
User | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |