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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AmiraBedh
Super User
Super User

Show the values for the last 12 months starting from the current month

I am using a live connection to an SSAS tabular cube, my measure is like below : 

 

StartedMeasure =
CALCULATE (
COUNT(Fact_Product[SK_product]),
dim_status_product[status] in {"Started"}
DATESINPERIOD (
dim_calendrier[id],
MAX ( dim_calendrier[id] ), 
-12, 
MONTH
)
)

 

InprogressMeasure =
CALCULATE (
COUNT(Fact_Product[SK_product]),
dim_status_product[status] in {"In Progress"},
DATESINPERIOD (
dim_calendrier[id], 
MAX ( dim_calendrier[id] ), 
-12, 
MONTH 
)
)

 

My current visual is like below : 

 

capalt_0-1654167712912.png

I want the X-axis to be displaying the count by month not by date :

If the current month is june : the X-axis will start from June 2021 to June 2022


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION

Create a MonthKey Column in Dte Dimension with "Year & MonthNumber" concatenated i.e. 202201 ,202202,202203 etc

 

and then use the Sort by other column property for your "Year-Month" column to sort at chronological order.







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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
FarhanAhmed
Community Champion
Community Champion

Create a column in your Date Dimension "Year-Month" and display it in x-axis instead of date column







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

Proud to be a Super User!




And how to display the values in the month-year order?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Create a MonthKey Column in Dte Dimension with "Year & MonthNumber" concatenated i.e. 202201 ,202202,202203 etc

 

and then use the Sort by other column property for your "Year-Month" column to sort at chronological order.







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

Proud to be a Super User!




I followed the same logic but the visual is not showing only the last 12 months, it goes beyond : 

capalt_0-1654263502058.png

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors