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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Ritaf
Responsive Resident
Responsive Resident

changing context to last month dax

Hi, 
I have a table with cars transactions by month like below:

carIDMonthly_KMmonth of transaction

1

100001/01/2020
1150001/02/2020
1130001/01/2021
2140001/01/2020
280001/01/2022

I am trying to bin cars by average km yearly, and when I visualize it in yearly granularity I want to count the cars of last month with the transaction. For example, in 2020 it is December and in 2021 it is April.
the counting with classifications working great and shows the right numbers on monthly granularity, but I have a problem, to filter for "last transaction's" month when it is a yearly granularity.  My formula is:

kmGroup =
SUMX('KM bins table''', COUNTROWS(FILTER('cars',[kmAverage]>'KM bins table'''[Min] && [kmAverage]<'KM bins table''[max])))
How can I fix it to show me the last month on yearly granularity (I have a date table)
Thank you, Rita
1 ACCEPTED SOLUTION
Ritaf
Responsive Resident
Responsive Resident

I solved it by myself with:

Fitered KM_group =
CALCULATE([kmGroup],LASTNONBLANK('Calendar[date]',[cars quantity])

View solution in original post

1 REPLY 1
Ritaf
Responsive Resident
Responsive Resident

I solved it by myself with:

Fitered KM_group =
CALCULATE([kmGroup],LASTNONBLANK('Calendar[date]',[cars quantity])

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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