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

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.

Reply
EmetSelch
Frequent Visitor

calculating a kind of histogram that responds to filters

greetings,

 

here's what i want to achieve:

several agents create calls with customers and log the date, the type etc.. i want to count the calls made on the same day (for every day), then i want to know the accumulation of calls per day (like, there were 3 occurances (dates) with 5 calls made on that day, 8 occurances with 1 call a day etc.)

 

i want to display the accumulation of calls with an x-axis (1 -> max calls per day) and an y-axis (accumulation of calls per day). thats all well and easy for the totals of calls per day, but i need to be able to filter the visual for agents (user), call type etc. using slicers or drill-through action.

 

my call table looks something like this:

 

createdOn   | userId | callType    | callId

dd.mm.yyyy | 1         | face2face  | 12345

 

for the x-axis i created a sperate table with:

xAxis = GENERATESERIES( 1; IF( ( MAX( call[callsOnThisDay] ) < 19 ); 19; MAX( call[callsOnThisDay] ) ); 1 )

and a column in my call table:

callsOnThisDay = SUMX( call; IF( call[createdOn] = EARLIER( call[createdOn] ); 1; 0 ) )

 

the callsOnThisDay column could be used if i just wanted to display the totals, unfiltered by agents or type. but that's not good for what my client wants. he needs filters ..

 

 

i'm fairly new to Power BI and i'm having troubles getting what i want from DAX, any help would be awesome.

 

1 ACCEPTED SOLUTION

thanks for the reply, not what i had hoped for though ..

could you maybe propose a workaround with similar results?

 

edit:

what i did now was this:

created a column in call table that calculates how many calls were made on the same day, another column in call table that calculates how many calls the agent of the call made that day.

to build the visuals, i create new index tables for every calculated column for call frequency and relate the column in call table with the index of the corresponding index table.

here's the DAX:

 

Calls total =IF(call[completed] = TRUE();SUMX(call;IF(call[date] = EARLIER(call[Date fix]) && call[Call] = TRUE();CALCULATE(DISTINCTCOUNT(call[callID]));0)))

 

Calls agents = IF(v_call[Call] = TRUE();CALCULATE(DISTINCTCOUNT(call[callID]);ALLEXCEPT(call;call[userID];call[date];call[type]));BLANK())

 

index Calls total = GENERATESERIES(1;MAX(call[Calls total]);1)

 

index Calls agents = GENERATESERIES(1;MAX(call[Calls total]);1)

 

 

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @EmetSelch ,

In fact, current power bi does not support to create dynamic calculate column/table based on filter/slicer. Dax formula which you used to get selected value will be fixed(it will calculate on 'whole' table) and return the static result.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

thanks for the reply, not what i had hoped for though ..

could you maybe propose a workaround with similar results?

 

edit:

what i did now was this:

created a column in call table that calculates how many calls were made on the same day, another column in call table that calculates how many calls the agent of the call made that day.

to build the visuals, i create new index tables for every calculated column for call frequency and relate the column in call table with the index of the corresponding index table.

here's the DAX:

 

Calls total =IF(call[completed] = TRUE();SUMX(call;IF(call[date] = EARLIER(call[Date fix]) && call[Call] = TRUE();CALCULATE(DISTINCTCOUNT(call[callID]));0)))

 

Calls agents = IF(v_call[Call] = TRUE();CALCULATE(DISTINCTCOUNT(call[callID]);ALLEXCEPT(call;call[userID];call[date];call[type]));BLANK())

 

index Calls total = GENERATESERIES(1;MAX(call[Calls total]);1)

 

index Calls agents = GENERATESERIES(1;MAX(call[Calls total]);1)

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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