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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
gabrielvigo
Helper I
Helper I

Enter data in variables

Hi everyone!

 

I have a static date filter in one measure.

For ecample: Today() -1.

 

But I need that this filter, Today()-1, calculate about selction date.

I need this, because some measures are specific to that date and others are accumulated until that date.

 

In summary, I need a variable / measure associated with the user's date selection.

1 ACCEPTED SOLUTION

Hi @gabrielvigo,

 

Try these formulas below.

Test =
CALCULATE (
    SUM ( Supply_Chain[Operations Stockouts] );
    FILTER (
        ALL ( 'Calendar'[Fecha] );
        'Calendar'[Fecha] = SELECTEDVALUE ( 'Calendar'[Fecha] )
    )
)
Test2 =
CALCULATE (
    SUM ( Supply_Chain[Operations Stockouts] );
    FILTER (
        ALL ( 'Calendar'[Fecha] );
        'Calendar'[Fecha] <= SELECTEDVALUE ( 'Calendar'[Fecha] )
    )
)

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

So typically you do this with a slicer and something like MAX or SELECTEDVALUE. "What If" measures were created for this purpose.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi.

 

No, I can't calculate them.

 

I need 2 calculations:

 

  1. Test = CALCULATE(SUM(Supply_Chain[Operations Stockouts]);'Calendar'[Fecha] = SELECTEDVALUE('Calendar'[Fecha]))
  2. Test2 = CALCULATE(SUM(Supply_Chain[Operations Stockouts]);'Calendar'[Fecha] <= SELECTEDVALUE('Calendar'[Fecha]))

 

Screenshot_1.png

 

 

Screenshot_2.png

Hi @gabrielvigo,

 

Try these formulas below.

Test =
CALCULATE (
    SUM ( Supply_Chain[Operations Stockouts] );
    FILTER (
        ALL ( 'Calendar'[Fecha] );
        'Calendar'[Fecha] = SELECTEDVALUE ( 'Calendar'[Fecha] )
    )
)
Test2 =
CALCULATE (
    SUM ( Supply_Chain[Operations Stockouts] );
    FILTER (
        ALL ( 'Calendar'[Fecha] );
        'Calendar'[Fecha] <= SELECTEDVALUE ( 'Calendar'[Fecha] )
    )
)

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.