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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
geetika09
New Member

Don't want to filter the selected dates (slicer) based on other tables

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

 

1 REPLY 1
DataInsights
Super User
Super User

@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:

DataInsights_0-1597101199113.png

 

With date filter:

 

DataInsights_1-1597101463632.png

 

Let me know if this solves your issue.

 

--Aaron





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

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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