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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ghamiz
Frequent 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
amitchandak
Super User
Super User

@ghamiz 
The formula and relation has some problem

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@ghamiz 
The formula and relation has some problem

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

hey this really worked, how silly of me 😞

 

thanks for the help

🙂

Greg_Deckler
Super User
Super User

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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