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
Ronak_Mistry
Frequent Visitor

Dax

Hello,

I have a two slicer in Datshboard one is Scheme Start date and End Date.
I want to fine new two date which is pre and post date with add  day of difference of two dates number of dates in Existing scheme start and end date in dax.
i want a measure not coloum.....

Example:   Scheme Start date :22-04-2021               

                 Scheme End Date : 31-5-2021
Number of Days Between Two Dates : 39 Days
I want a Two date Pre Scheme Date : 14-3-2021
Post Scheme Date:09-07-2021

in Measure......
Nd Then i want a Sales Between Two Dates 

 

 

1 ACCEPTED SOLUTION
eliasayy
Impactful Individual
Impactful Individual

hello im not sure if i understood you correctly but please try:

 

 

 

Days = 
VAR _min = MIN(Sheet1[Start Date])
VAR _max = MAX(Sheet1[End Date])
Return
COUNTROWS(CALENDAR(_min,_max))-1

 

 

 

 

make sure to go to format ---> edit interactions and select none on each slicer

Screenshot 2022-10-22 134621.png

 

now to find post and pre:

 

 

Pre Scheme = MIN(Sheet1[Start Date]) - [Days]

Post scheme = MAX(Sheet1[End Date]) + [Days]

 

 

end.png

 

and another example:

Screenshot 2022-10-22 135301.png

 

then to find your desired sales:

 

Measure = 
CALCULATE (
    SUM ( salestable[sales] ),
    FILTER (
        salestable,
        salestable[Date] >= pre scheme )
            && salestable[Date] <= psotscheme )
    )
)

 

dont forget to create a relationship between scheme table and salestable

if you find it helpful a kudos would be appreciated and consider accepting as solution



View solution in original post

2 REPLIES 2
eliasayy
Impactful Individual
Impactful Individual

hello im not sure if i understood you correctly but please try:

 

 

 

Days = 
VAR _min = MIN(Sheet1[Start Date])
VAR _max = MAX(Sheet1[End Date])
Return
COUNTROWS(CALENDAR(_min,_max))-1

 

 

 

 

make sure to go to format ---> edit interactions and select none on each slicer

Screenshot 2022-10-22 134621.png

 

now to find post and pre:

 

 

Pre Scheme = MIN(Sheet1[Start Date]) - [Days]

Post scheme = MAX(Sheet1[End Date]) + [Days]

 

 

end.png

 

and another example:

Screenshot 2022-10-22 135301.png

 

then to find your desired sales:

 

Measure = 
CALCULATE (
    SUM ( salestable[sales] ),
    FILTER (
        salestable,
        salestable[Date] >= pre scheme )
            && salestable[Date] <= psotscheme )
    )
)

 

dont forget to create a relationship between scheme table and salestable

if you find it helpful a kudos would be appreciated and consider accepting as solution



Thanks......

Its Working properly......

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.