Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
PBI5851
Helper V
Helper V

Creating a Chart with x axis to be dynamic

Hello,

I am trying a develop a graph using the below data 

OrderNoOrdDateCallTypeCallDateCallID
A12312/20/2022Initial1/2/2023C1234
A12312/20/2022Initial1/2/2023C1235
A12312/20/2022Service1/5/2023C1236
A12312/20/2022Service1/7/2023C1237
A12312/20/2022Service1/8/2023C1238
A12312/20/2022Shipping1/8/2023C1239
A12312/20/2022Shipping1/8/2023C1240
A12312/20/2022Service1/9/2023C1241
A12312/20/2022Service1/10/2023C1242
A12312/20/2022Service1/11/2023C1243
A12312/20/2022Service1/12/2023C1244
B12311/15/2022Initial1/3/2023C1245
C12311/20/2022Initial1/5/2023C1246
D12311/25/2022Initial1/5/2023C1247
D12311/25/2022Service1/10/2023C1248
D12311/25/2022Shipping1/10/2023C1249
E1231/2/2023Initial1/2/2023C1250
E1231/2/2023Shipping1/5/2023C1251
E1231/2/2023Shipping1/5/2023C1252

 

The requirement is to have a calldate and orddate slicer but plot in 3 unique graphs the below. 

- An Initial call count graph

- A Service call count graph

- A shipping call count graph

the graph should be the distinct count of Orders who have had 0, 1, 2, 3, 4, 5 Initial call, where 0,1,2,3,4,5 is on the x axis 

 

For a Shipping call count graph:

With a OrdDate Slicer from 11/1/22 - 1/31/22 AND with a call date slicer as 12/1/22 - 12/20/22

the first column for 0 (on x axis) should be 5 (this is because none of the 5 orders had calls within the secondary date range)

 

With a OrdDate Slicer from 11/1/22 - 1/31/22 AND with a call date slicer as 1/1/23 - 1/20/23

the first column for 0 (on x axis) should be 2 (this is because B123 and C123 had 0 calls within the secondary date range)

the second column for 1 (on x axis) should be 3 (because A123, D123, E123 each had atleast 1 shipping call within the secondary date range)

 

With a OrdDate Slicer from 11/1/22 - 1/31/22 AND with a call date slicer as 1/1/23 - 1/5/23

the first column for 0 (on x axis) should be 4 (this is because A123, B123, C123, D123 had 0 calls within the secondary date range)

the second column for 1 (on x axis) should be 1 (because A123, D123, E123 each had atleast 1 shipping call within the secondary date range)

 

The same concept for Initial and Service calls. I did try to use a summarize table solution, but the slicer is throwing me off. When i select the date, the members with no calls dont show (i.e column with 0 calls). And if i use the EXCEPT , then the filter is not applied at all. 

 

Any recommendations on how to resolve this please.

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Hi @PBI5851 , 

I've tried to recreate what i believe is your end-goal. 

tex628_2-1672915401644.png


How does this match your intended output? 

It's done with the following measures: 

Shipping Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Shipping") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)
Service Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Service") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)
Initial Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Initial") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)


Plus a small static table to populate the x-axis:

 

tex628_3-1672915524816.png


/ J

 


Connect on LinkedIn

View solution in original post

3 REPLIES 3
tex628
Community Champion
Community Champion

Hi @PBI5851 , 

I've tried to recreate what i believe is your end-goal. 

tex628_2-1672915401644.png


How does this match your intended output? 

It's done with the following measures: 

Shipping Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Shipping") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)
Service Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Service") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)
Initial Call Count = 
VAR totalOrders = CALCULATE( DISTINCTCOUNT( Orders[OrderNo] ) , REMOVEFILTERS( Orders[CallDate] ))
VAR WithCalls = COUNTROWS( FILTER ( SUMMARIZE( Orders , Orders[OrderNo] , Orders[CallType] , "Value" , COUNTROWS( Orders ) ) , [Value] >= 1 && Orders[CallType] = "Initial") )
Return
SWITCH( SELECTEDVALUE( 'Count'[Count] ) , 
"0" , totalOrders - WithCalls ,
"1" , WithCalls
)


Plus a small static table to populate the x-axis:

 

tex628_3-1672915524816.png


/ J

 


Connect on LinkedIn

Thank you @tex628 . Wil try it out. Can you send me your pbix file please.

tex628
Community Champion
Community Champion

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.