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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Rodrigo_fig15
Regular Visitor

Measure to adjust scale of dual axis chart (drilling up and down)

Hi everyone,

 

I need some help to create a DAX measure that I can adjust the scale when drilling up and down on a dual axis chart. The bars and row of chart (y axis and y secundary axis) need to have the same measure as a scale. The chart drill up and down from year to day. See the example below:

 

When I drill down to the day visual, I need that my scale (of both y axis) goes 0 to 24 (number of hours of day) * [Measure]. 

 

Rodrigo_fig15_0-1689882650825.png

 

 

When I drill up to the month visual, I need that my scale goes 0 to 744 (maximum number of hours of a month) * [Measure]

 

Rodrigo_fig15_1-1689854408308.png

 

And when I drill up to the year visual I need that my scale goes 0 to 8760 (number of hours of a year) * [Measure]

Rodrigo_fig15_2-1689854427126.png

 

 



I'm trying this measure but it is not working:

 

 

Scale of chart = 
// var vPotenciaInstalada = [Measure]
var vRows = CALCULATE(COUNTROWS(VALUES('Calendar'[Date])))
var vHours = SWITCH(
     TRUE(),
     vRows < 32, 24, // Context of DAY, scale goes 0 to 24 * [Measure]
     vRows > 31 || vRows < 367, 744, // Context of MONTH, scale goes 0 to 744 * [Measure]
     8760 // Context of YEAR, scale goes 0 to 8760 * [Measure]
)
var vLimiteSuperior =  vHours
var vCalculo = SWITCH (
    TRUE (),
    ISFILTERED('Calendar'[Day]), vLimiteSuperior,
    ISFILTERED('Calendar'[Month]), vLimiteSuperior,
    ISFILTERED('Calendar'[Year]), vLimiteSuperior,
    BLANK ()
)

return
vCalculo

 

 

 

I can't attached files here so I'm sharing this link on Google Drive with the pbix file.

PBIX file 

Any ideas of how to do this?

Appreciate all of your help,

Regards

0 REPLIES 0

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.