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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.