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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Help With IF Sum

Hi,

 

I am trying to recreate the following calculation into a DAX Measure. Please can someone advice how ths is possible:-

 

    if  {Job_Mth}<={Current Month (Year Month YYYY-MMM Selection from Slicer} then

         {Job Projected Pounds}

    else

         {Job Contract Amount}

 

Thanks in advance

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

I am not sure if I understood your question correctly. If you use this formula, 

IF_Measure = 
IF (
    MAX ( 'Table'[ProjMth] ) <= EOMONTH ( TODAY (), 0 ),
    SUM ( 'Table'[ProjDollars] ),
    SUM ( 'Table'[ContractAmt] )
)

because 12/1/2050 > 4/30/2022, then return SUM ( 'Table'[ContractAmt] ), i.e. 12182946.

 

If you want to calculate the sum of column [ProjDollars] less than or equal to the current month, please try:

 

less_equal_currentperiod = 
CALCULATE (
    SUM ( 'Table'[ProjDollars] ),
    FILTER ( 'Table', 'Table'[ProjMth] <= EOMONTH ( TODAY (), 0 ) )
)

vkkfmsft_1-1649057128909.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Hi<

 

Thanks again.

 

Ok so i have a date in thefuture in my projmnth field. When we use MAX in the measure its taking this into consideration which i want to ignore.

 

Any proj months after the current period selected need to sum the contract amount anything less than or equal to the current period needs to sum proj dollars.

 

On the example below i wish to get the sum of proj dollars (12,210.130.00) the measure is returning the other value

 

Eg.png

amitchandak
Super User
Super User

@Anonymous , If you have job_date it would much more easy

measure

= if(max(Table[Job Date]) <= eomonth(Today(),0)  ,[Job Projected Pounds], [Job Contract Amount])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors