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

How to create measure with Date condition?

Hello all,

I need to create a measure having Date condition but It is showing errors, any help please?

It should work. 

 

Measure = IF(DimDates[Date] < DATE(2024,1,1), DIVIDE(SUM(Metrics[Revenue_DKK]),0.77), DIVIDE(SUM(Metrics[Revenue_DKK]),0.240870000))
 
Untitled.jpgUntitled3.jpg
Thank you for your help
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @lucie_rabochova,

Current you cannot directly invoke the table columns in the measure formula.
I'd like to suggest you add aggregate functions to process on it to get value from current row context instead directly use table column in your conditions:

Measure =
IF (
    MAX ( DimDates[Date] ) < DATE ( 2024, 1, 1 ),
    DIVIDE ( SUM ( Metrics[Revenue_DKK] ), 0.77 ),
    DIVIDE ( SUM ( Metrics[Revenue_DKK] ), 0.240870000 )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @lucie_rabochova,

Current you cannot directly invoke the table columns in the measure formula.
I'd like to suggest you add aggregate functions to process on it to get value from current row context instead directly use table column in your conditions:

Measure =
IF (
    MAX ( DimDates[Date] ) < DATE ( 2024, 1, 1 ),
    DIVIDE ( SUM ( Metrics[Revenue_DKK] ), 0.77 ),
    DIVIDE ( SUM ( Metrics[Revenue_DKK] ), 0.240870000 )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the solution. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

Remove any unneeded columns which may cause confussion.

Rename columns to user friendly names.
Also provide the example desired output, with a clear step-by-step description of calculations and process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gerrting free expert help, so please put lots of proper effort to asking questions and providing example.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors