cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Count of days based on filter for average

Hi, i am a newbie in power bi so pardon my ignorance 🙂

I have application wise traffic data since 24-Feb-2020 till 08-Apr-2020 (45 days). An application has sub application so for single day multiple rows per application is possible.

 

I just want to get daily average traffic of each application based on the selected days in filter. But i am unable to get the days count correctly.

 

I applied month filter for Apr, there are 8 dates data for April. It is possible that some application might have only 5 days data for April. So i want to return count of days per each application.

 

I used following formula, but it is returning me 45 for each application, though i've applied Apr filter.

 

Measure =
var start_Date=FIRSTDATE(ALLSELECTED('App'[Date]))
var end_Date=LASTDATE(ALLSELECTED('App'[Date]))
return
CALCULATE(DATEDIFF(start_Date, end_Date, DAY))
 
Capture.PNG
Capture2.PNG

 

 
 
 
Once i get the correct count of day, I will divide it with sum of traffic to get the average.
 
any help would be appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Count of days based on filter for average

@ghamiz 
The formula and relation has some problem

distinct date use
distinctcount('App'[Date])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

3 REPLIES 3
Highlighted
Super User IV
Super User IV

Re: Count of days based on filter for average

It looks like a relationship is not setup correctly. 

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Super User IV
Super User IV

Re: Count of days based on filter for average

@ghamiz 
The formula and relation has some problem

distinct date use
distinctcount('App'[Date])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Regular Visitor

Re: Count of days based on filter for average

hey this really worked, how silly of me 😞

 

thanks for the help

🙂

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors