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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.


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!:
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.