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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dex98powerbi
New Member

Measures to returning correct value

I have a sales table that consist [date,sales amount] There is sales date from 2024 and 2025
I have date table that consist [date, year, month, day, week, weekyear(custom column to show year does the week belongs to example date 31st December 2024 , week year is 2025 because it is week1 of 2025). The table consist date from 2019 to 2025

everything is working correctly including the custom column weekyear. Until if i place my measures with weekyear, it is not returning the correct thing. It starts showing year 2019 to 2025 even if I do not have any sales data from 2019 to 2023. 

Below are my measures 

total_sales_all_session =
CALCULATE(
    SUM('sales'[sales_amount]),
    'date'[week_year] IN {2025, 2024}
)

draws_all_session =
CALCULATE(
    SUM('date'[is_draw_date_session]),
    'date'[is_draw_date] = TRUE,
    'date'[week_year] IN {2024, 2025}
)
total_normalise_sales_all =
[total_sales_all_session]/[draws_all_session]
 

if i am using year and week in the visuals, logically are correct, because it did not include year from 2019 to 2023. When i use week with the custom week year, it will start display values from 2019 to 2025. 

I tried my custom column with the data directly from the sales table, it works fine. Just problem with my measures

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try using KEEPFILTERS DAX function in the measures that you wrote.

KEEPFILTERS function (DAX) - DAX | Microsoft Learn

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try using KEEPFILTERS DAX function in the measures that you wrote.

KEEPFILTERS function (DAX) - DAX | Microsoft Learn

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you very much, after days of research, debugging, and your simple "Keep Filters" finally solved my headache. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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