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
Dannismen
Helper I
Helper I

YTD Value Formula adjusted by date slider

Hi all, 
 
Can someone plz revise the below formula so it will be adjusted by [Fiscal_BOW] date slider and always start with 0. 
 
Current Year =
VAR __to = MAX(Qry_6999_UNION_ALL[Fiscal_BOW] )
VAR __from =
MINX(
CALCULATETABLE(
Qry_6999_UNION_ALL,
Qry_6999_UNION_ALL[Fiscal_BOW] ,
Qry_6999_UNION_ALL[Fiscal_BOW] <= __to
),
Qry_6999_UNION_ALL[Fiscal_BOW]
)
RETURN
CALCULATE(
SUM( Qry_6999_UNION_ALL[Metric_Value] ),
DATESBETWEEN( Qry_6999_UNION_ALL[Fiscal_BOW], __from, __to )
)
1 ACCEPTED SOLUTION

Hi @Dannismen

 

You can try measure as:

 

Current Year = 
VAR __to = CALCULATE(ALLSELECTED(Date_slicer[Date]),Date_slicer[Date])
VAR __from =CALCULATE(MINX(ALLSELECTED(Date_slicer[Date]),Date_slicer[Date]))

RETURN
CALCULATE(
SUM( Qry_6999_UNION_ALL[Metric_Value] ),
FILTER(
    Date_slicer,
    DATESBETWEEN( Qry_6999_UNION_ALL[Fiscal_BOW], __from, __to ) && Date_slicer[Date]=MAX(Qry_6999_UNION_ALL[Fiscal_BOW])
)
)

 

If you expect the date slice range to be larger than the date column in the table, you need to create the date dimension for the date slicer, and put it in the x-axis of visual.

Here is the output:

vxulinmstf_0-1624249509988.png

The pbix is attached.

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

4 REPLIES 4
Dannismen
Helper I
Helper I

The current visual shows the cumulative starts the first day of 2021 but I want it to show the one that starts with the date slider. 

Dannismen_0-1624052481254.png

 

Hi @Dannismen

 

You need to create the date dimension for the date slicer, associate the measure to that date dimension and put it in the x-axis of visua.

For more information about creatint dimension table, you can refer:

One Dimension Filters Another Dimension in Power BI - RADACAD

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

Hi, 

 

Thanks for your reponse but it still showed the same thing when I did what you suggested. I think it's the matter of the formula. Would you mind take a look? Thanks

Hi @Dannismen

 

You can try measure as:

 

Current Year = 
VAR __to = CALCULATE(ALLSELECTED(Date_slicer[Date]),Date_slicer[Date])
VAR __from =CALCULATE(MINX(ALLSELECTED(Date_slicer[Date]),Date_slicer[Date]))

RETURN
CALCULATE(
SUM( Qry_6999_UNION_ALL[Metric_Value] ),
FILTER(
    Date_slicer,
    DATESBETWEEN( Qry_6999_UNION_ALL[Fiscal_BOW], __from, __to ) && Date_slicer[Date]=MAX(Qry_6999_UNION_ALL[Fiscal_BOW])
)
)

 

If you expect the date slice range to be larger than the date column in the table, you need to create the date dimension for the date slicer, and put it in the x-axis of visual.

Here is the output:

vxulinmstf_0-1624249509988.png

The pbix is attached.

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

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.