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
Tobias106
Helper I
Helper I

Show calculated value only in the corresponding year

Hello together,

 

I have a "Table" which is linked to the "Calendar".

 

The "Table" contains the years 2020 - 2023.

 

What I want to do is to calculate the Revenue for 2020 in a Measure. This works with the following code:

 

Revenue 2020 = 
CALCULATE(SUM('Table'[Revenue]), ALLEXCEPT('0_Calendar','0_Calendar'[Year]),'0_Calendar'[Year]=2020, 'Table'[Criteria]=0)

 

 

BUT: The calculated value for 2020 is now in every date row from 2020 - 2023. I only want to show the calculated 2020-value for dates in 2020, that means from 01.01.2020 - 31.12.2020.

 

Should look like this:

DateCalculated value
01.01.202010
02.01.202010
...10
31.12.202010
01.01.2021 
05.01.2021 
31.12.2021 
... 

 

How can I fix the problem?

 

Thank you in advance

 

BR

Tobias

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Tobias106 

maybe you can try this

Measure = if(year(max('calendar'[Date]))=2020,CALCULATE(sum('Table'[value]),FILTER(all('Table'),year('Table'[date])=2020)))
1.PNG
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@Tobias106 

maybe you can try this

Measure = if(year(max('calendar'[Date]))=2020,CALCULATE(sum('Table'[value]),FILTER(all('Table'),year('Table'[date])=2020)))
1.PNG
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Awesome, thank you very much 🙂

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




speedramps
Super User
Super User

Try create these 3 measures

Revenue = SUM('Table'[Revenue])

 

Revenue 2020 =
CALCULATE(
[Revenue]
Calendar'[Year]=2020)

 

Revenue 2021 =
CALCULATE(
[Revenue]
Calendar'[Year]=2021)

 

Then create add atbake visual to your report canvas with

Calendar'[Year], Revenue, Revenue 2020, Revenue 2021 

 

Note what happens.

Revuew shows the revenuw for each year but Revenue 2020 and Revenue 2021 override the filter context

 

Please do all these free training models about Power Bi calendar tables

 

Click here to start training 

 

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 crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the DAX. 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.
Also provide the example desired output, with a clear description of the process flow.

Remember not to share private data ... we don't want you to get into trouble. 😧

Take care to use the same table and field names in the input, output and description so we can understand your problem and help you.

You will get a quick response if you put time and effort into writing clear problem descriptions.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

 

 

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.