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
michael_knight
Post Prodigy
Post Prodigy

Two measures - One uses the current month, the other uses previous months

Hi,

 

I've been struggling on this problem for a while now. I want to create a measure that uses two other measures. I want it to show a certain measure in the current month and in all the previous months show another measure

 

I want the yellow line to show the previous months, and the red line to only show the previous months

Targets.PNG

 

This is the code I've current got but this isn't working. This code only shows the [Target] measure for every month and not the [WBAH Target] measure

IsCurrentMonth = 
IF (
    MONTH ( SELECTEDVALUE ('Full Date'[Full Date])) = MONTH ( NOW () )
 && YEAR ( SELECTEDVALUE ('Full Date'[Full Date])) = YEAR ( NOW () ),
    [Target],
    SELECTEDVALUE('Targets- WBAH'[Target], 'Targets- WBAH'[WBAH Target]) ) 

  

Any help is welcomed

 

Thanks,

Mike

1 ACCEPTED SOLUTION

If so, there there might be some issue in calculating whether or not you're in the current month

VAR is_current = selected_Month = cur_month && selected_year = cur_year

try

VAR is_current_month = selected_month = cur_month

VAR is_current_year = selected_year = cur_year

and return those and see what you get

you can then do

VAR is_current = AND(is_current_month,is_current_year)





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


View solution in original post

14 REPLIES 14

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.