Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Scatter plot not working with count of distinct date value slicer & also for month slicer
11-26-2023
09:53 PM
BELOW IS THE EXACT REQUIREMENT FROM CLIENT
I have created a scatter plot with 16 grids(percentile lines 25th,50th,75th & 100th for both X & Y axes in PowerBI analytics pane option). In X-axis service wise average EPK & in Y-axis service operated days(Which is count of distinct date column service wise).
Below are the DAX I used:
Service_Distinct Date Count =
CALCULATE(
DISTINCTCOUNT('agg_route_trip'[Date]),
ALLEXCEPT('agg_route_trip', 'agg_route_trip'[service])
)
-----------------------------------------------------------Service Average EPK =
CALCULATE(
AVERAGE('agg_route_trip'[epk]),
ALLEXCEPT('agg_route_trip', 'agg_route_trip'[Service])
)
---------------------------------------------------------
I created 2 new tables SummaryTableX (Service wise Avg EPK) & SummaryTableY (Service wise count of distinct dates). I connected both these tables to agg_route_trip table(main table) via one to many relationship through service column.
Now in the scatter plot there are 16 grids(4*4). Client wants to check each grid wise data.
For this I created a new column Grid3 based on service wise average EPK & count of distinct dates service wise. For the Grid3 column I used the below DAX
----------------------------------------------------------------------------------------------------
Grid3 =
VAR X_25th_Percentile = PERCENTILEX.INC(SummaryTableX, [EPK], 0.25)
VAR Y_25th_Percentile = PERCENTILEX.INC(SummaryTableY, [Service Operated Days], 0.25)
VAR X_50th_Percentile = PERCENTILEX.INC(SummaryTableX, [EPK], 0.50)
VAR Y_50th_Percentile = PERCENTILEX.INC(SummaryTableY, [Service Operated Days], 0.50)
VAR X_75th_Percentile = PERCENTILEX.INC(SummaryTableX, [EPK], 0.75)
VAR Y_75th_Percentile = PERCENTILEX.INC(SummaryTableY, [Service Operated Days], 0.75)
VAR X_100th_Percentile = MAX(SummaryTableX[EPK])
VAR Y_100th_Percentile = MAX(SummaryTableY[Service Operated Days])
RETURN
SWITCH(
TRUE(),
[Service Average EPK] <= X_25th_Percentile && [Service Distinct Date Count] <= Y_25th_Percentile, "Grid 1",
[Service Average EPK] > X_25th_Percentile && [Service Average EPK] <= X_50th_Percentile && [Service Distinct Date Count] <= Y_25th_Percentile, "Grid 2",
[Service Average EPK] > X_50th_Percentile && [Service Average EPK] <= X_75th_Percentile && [Service Distinct Date Count] <= Y_25th_Percentile, "Grid 3",
[Service Average EPK] > X_75th_Percentile && [Service Average EPK] <= X_100th_Percentile && [Service Distinct Date Count] <= Y_25th_Percentile, "Grid 4",
[Service Average EPK] <= X_25th_Percentile && [Service Distinct Date Count] > Y_25th_Percentile && [Service Distinct Date Count] <= Y_50th_Percentile, "Grid 5",
[Service Average EPK] > X_25th_Percentile && [Service Average EPK] <= X_50th_Percentile && [Service Distinct Date Count] > Y_25th_Percentile && [Service Distinct Date Count] <= Y_50th_Percentile, "Grid 6",
[Service Average EPK] > X_50th_Percentile && [Service Average EPK] <= X_75th_Percentile && [Service Distinct Date Count] > Y_25th_Percentile && [Service Distinct Date Count] <= Y_50th_Percentile, "Grid 7",
[Service Average EPK] > X_75th_Percentile && [Service Average EPK] <= X_100th_Percentile && [Service Distinct Date Count] > Y_25th_Percentile && [Service Distinct Date Count] <= Y_50th_Percentile, "Grid 8",
[Service Average EPK] <= X_25th_Percentile && [Service Distinct Date Count] > Y_50th_Percentile && [Service Distinct Date Count] <= Y_75th_Percentile, "Grid 9",
[Service Average EPK] > X_25th_Percentile && [Service Average EPK] <= X_50th_Percentile && [Service Distinct Date Count] > Y_50th_Percentile && [Service Distinct Date Count] <= Y_75th_Percentile, "Grid 10",
[Service Average EPK] > X_50th_Percentile && [Service Average EPK] <= X_75th_Percentile && [Service Distinct Date Count] > Y_50th_Percentile && [Service Distinct Date Count] <= Y_75th_Percentile, "Grid 11",
[Service Average EPK] > X_75th_Percentile && [Service Average EPK] <= X_100th_Percentile && [Service Distinct Date Count] > Y_50th_Percentile && [Service Distinct Date Count] <= Y_75th_Percentile, "Grid 12",
[Service Average EPK] <= X_25th_Percentile && [Service Distinct Date Count] > Y_75th_Percentile && [Service Distinct Date Count] <= Y_100th_Percentile, "Grid 13",
[Service Average EPK] > X_25th_Percentile && [Service Average EPK] <= X_50th_Percentile && [Service Distinct Date Count] > Y_75th_Percentile && [Service Distinct Date Count] <= Y_100th_Percentile, "Grid 14",
[Service Average EPK] > X_50th_Percentile && [Service Average EPK] <= X_75th_Percentile && [Service Distinct Date Count] > Y_75th_Percentile && [Service Distinct Date Count] <= Y_100th_Percentile, "Grid 15",
[Service Average EPK] > X_75th_Percentile && [Service Average EPK] <= X_100th_Percentile && [Service Distinct Date Count] > Y_75th_Percentile && [Service Distinct Date Count] <= Y_100th_Percentile, "Grid 16",
BLANK()
)
--------------------------------------------------------------------------------------------
Client Requirement is On selection of particular grid, in the scatter plot should show only that grid data. This is working fine on the entire data. But if month filter is applied & in that particular month 16 grids are coming in the visual. Now Client wants to check month wise each grid data. Ex In month of july they want to check each grid wise. But I am facing issue here. Please help me. I hope I am clear with my explanation.
Below is the sample file
0 REPLIES 0

Helpful resources
Announcements
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Recommendations
Subject | Author | Posted | |
---|---|---|---|
10-17-2023 11:48 PM | |||
12-07-2023 07:09 AM | |||
05-20-2024 10:50 PM | |||
05-22-2024 06:53 AM | |||
06-28-2024 04:58 AM |
Top Solution Authors (Last Month)
User | Count |
---|---|
24 | |
13 | |
11 | |
10 | |
9 |
Top Kudoed Authors (Last Month)
User | Count |
---|---|
18 | |
14 | |
14 | |
12 | |
11 |