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
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
Super User
Super User

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


@ 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!:
The Definitive Guide to Power Query (M)

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
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.