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
bathbath
Frequent Visitor

Clicking on a graph should change the measure value

Hello,

 

I have this bar graph. My question is if someone clicks on the graph to say January then I want to show 1, if it is CTRL and they chose any 2 months then I want to show 2, if I don't select anything then 12 (if it is not current year) and the total number of months if it is current year. ( I am not talking about EDIT INTERACTIONS).

With slicers it's easy, but I want to show number of months when someone clicks on the graph. These are getting used in my other formulas so this number of month will become denominator in bigger formula. 

bathbath_0-1721357962251.png


This is a return for my formula which works fine except it sums all the stores so I want to add Month measure and divide it by that based on the month selected. 


RETURN
    CALCULATE(
        sum(FACT_Store_Metrics[Store_Count_Metric]),
        USERELATIONSHIP(FACT_Store_Metrics[Date_Metric_Month_SK], DIM_Date_Rpt_P3[Date_Rpt_p3_SK]),
        KEEPFILTERS(DIM_Franchise[Franchise_SK]),
        KEEPFILTERS(DIM_Reporting_Source[Reporting_Source_SK]),
        USERELATIONSHIP(FACT_Store_Metrics[Date_Metric_Month_SK], DIM_Date_Rpt_P3[Date_Rpt_p3_SK])
    )

Please let me know if needed further clarification.

Thanks in advance.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@bathbath , Your measure will filter data from the table and related table on one side. Assuming a date table is used and use filtered it will remove data

 

Assume you have a measure, M1. This code will show a selected range or 12 months range

 

new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = eomonth(_max , -12) +1
var _fil = calculate(isfiltered('Date'), allselected('Date'))
return if(_fil, [M1],
calculate( [M1], filter('Date', 'Date'[Date] <=_max && 'Date'[Date] > _min)) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@bathbath , Your measure will filter data from the table and related table on one side. Assuming a date table is used and use filtered it will remove data

 

Assume you have a measure, M1. This code will show a selected range or 12 months range

 

new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = eomonth(_max , -12) +1
var _fil = calculate(isfiltered('Date'), allselected('Date'))
return if(_fil, [M1],
calculate( [M1], filter('Date', 'Date'[Date] <=_max && 'Date'[Date] > _min)) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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