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
PowerBINoob12
Helper I
Helper I

Dividing data by the number of months selected on a filter

I have a table of data that contains metrics for the year

PowerBINoob12_0-1681987677810.png


I want to create a measure that will sum all the values in the SLA column and then divide that my the number of months I select when I filter on month.

for example If I filter on Jan, March and Dec I want to add 86.26 + 87.65 + 86.85 and divide that by 3 (number of months selected on my drop down filter).

can anyone explain to me how to do the logic around dividing my the number of months selected in my filter please?

I have a calendar already set up as well if this helps.



1 ACCEPTED SOLUTION

Hi @PowerBINoob12,

You can consider to use ALLSELECTED function to package and apply current filter effect to the Dax expression:

formula =
CALCULATE (
    DIVIDE ( SUM ( Table[SLA] ), COUNTROWS ( VALUES ( Table[Month] ) ) ),
    ALLSELECTED ( Table )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
PowerBINoob12
Helper I
Helper I

Thought :

Would creating a column in my calendar that mapped the number 1 beside each month help?

example:

Sum(SLA) / (Countrows("MonthEquals1")

where the "monthEquals1" filter adds one for each month selected?

Hi,

Does this measure work

 

Measure = DIVIDE(SUM(Table[SLA]),COUNTROWS(ALLSELECTED(Table[Month])))

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @PowerBINoob12,

You can consider to use ALLSELECTED function to package and apply current filter effect to the Dax expression:

formula =
CALCULATE (
    DIVIDE ( SUM ( Table[SLA] ), COUNTROWS ( VALUES ( Table[Month] ) ) ),
    ALLSELECTED ( Table )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.