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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

If selected date is less than date, use this measure else other measure

Hello everyone i have 2 calculations, and a date timeline slicer 

 

First calculation is var newrevenue = sum(revenuetable[total_amount])

 

Second calculation is var oldrevenue = Sumx(revenuetable, revenuetable[quantity] * revenuetable[amount])

 

I have one measure 

 

Financial value =

 

var newrevenue = sum(revenuetable[total_amount])

 

var oldrevenue = Sumx(revenuetable, revenuetable[quantity] * revenuetable[amount])

 

Var expenses = sum(expenses[total]

 

Now here is my challenge if i selected on timeslicer month of october and onwards, i want to get result from newrevenue calculation else everything before october i want oldrevenue cculation 

 

So something like

 

Var grossprofit = if( date < DATE(2022,10,1),oldrevenue,newrevenue) - expenses

 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Assume all these are part on a measure, based on what I  got

 

Var grossprofit = if( date < maxx(allselected('Date'), 'Date'[Date]),oldrevenue,newrevenue) - expenses

 

You might need use Sumx with some group by column for the correct grand total

 

Var grossprofit = Sumx(Values(Account[Account]) ,calculate( if( date < maxx(allselected('Date'), 'Date'[Date]),oldrevenue,newrevenue) - expenses ) )

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

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure = var _selected=SELECTEDVALUE('date'[Date])
return
IF(_selected<=TODAY(),[measure1],[Measure2])

vpollymsft_0-1665541102061.png

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without  privacy inforamtion.

 

Best Regards

Community Support Team _ Polly

 

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
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure = var _selected=SELECTEDVALUE('date'[Date])
return
IF(_selected<=TODAY(),[measure1],[Measure2])

vpollymsft_0-1665541102061.png

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without  privacy inforamtion.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Assume all these are part on a measure, based on what I  got

 

Var grossprofit = if( date < maxx(allselected('Date'), 'Date'[Date]),oldrevenue,newrevenue) - expenses

 

You might need use Sumx with some group by column for the correct grand total

 

Var grossprofit = Sumx(Values(Account[Account]) ,calculate( if( date < maxx(allselected('Date'), 'Date'[Date]),oldrevenue,newrevenue) - expenses ) )

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
Anonymous
Not applicable

Thank you very much 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.