cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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:

 Date Calculated value 01.01.2020 10 02.01.2020 10 ... 10 31.12.2020 10 01.01.2021 05.01.2021 31.12.2021 ...

How can I fix the problem?

BR

Tobias

1 ACCEPTED SOLUTION
Super User

maybe you can try this

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

Proud to be a Super User!

4 REPLIES 4
Super User

maybe you can try this

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

Proud to be a Super User!

Helper I

Awesome, thank you very much 🙂

Super User

you are welcome

Proud to be a 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)

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

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors