Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I am trying to Calculate some parameters like number of codes tripped per day . When I am viewing the data over a date range the calculated values are correct but if I select a particular code that had tripped in the specified date range then the Codes Tripped Per day parameter goes haywire.
For example:
Date Range is 19 Aug 2018 to 25 Aug 2018
Total Numbers of code tripped = 10
Codes Tripped Frequency
x1 2
x2 1
x3 4
x4 3
Now if I want a statistic to display
CodesTrippedPerDay for all codes = 10/6=1.67
CodesTrippedPerDay for say x1 =2/6 =0.33 instead I am getting as 1 because this code tripped on 19th and 20th august. So when I select this code in the table my whole data gets filtered out and gives me statistics based on dates this code actually tripped instead of giving me statistics across the whole date range without filtering out data. Can anyone tell me how to write my dax formulas to not do filtering based on date slicer.
My current DAX formula are:
CodePerDay2 = count('Sheet1'[Diag Code])/[DaysSelected]
DaysSelected = datediff(min(Sheet1[Issue Date]),max(Sheet1[Issue Date]),day)
Thanks
@geetika09 , try the following measures:
Frequency = COUNT ( CodeTrips[Code] )
Days Selected =
VAR vMinDate =
CALCULATE ( MIN ( CodeTrips[Issue Date] ), ALL ( CodeTrips[Code] ) )
VAR vMaxDate =
CALCULATE ( MAX ( CodeTrips[Issue Date] ), ALL ( CodeTrips[Code] ) )
VAR vNumDays =
DATEDIFF ( vMinDate, vMaxDate, DAY )
RETURN
vNumDays
Codes Tripped Per Day = DIVIDE ( [Frequency], [Days Selected] )
Without date filter:
With date filter:
Let me know if this solves your issue.
--Aaron
Proud to be a Super User!
User | Count |
---|---|
85 | |
74 | |
71 | |
68 | |
56 |
User | Count |
---|---|
98 | |
96 | |
92 | |
78 | |
70 |