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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AlexXandyr
Helper I
Helper I

Dynamic measure with date slicers

Hello, 
I have encountered a problem with my report. Im trying to show some KPIs for couple different warehouses where I base it on some variable cost and fixed variables with possibility to use a month slicer. 

 

  Warehouse 1Warehouse 2Comment

Variable

cost

Cost for storageXYVariable, and based on sum measure (Cost for Storage_m = CALCULATE(sum(Actuals[Amount_r]),Actuals[Cost type] ="Cost for Storage")
Fixed costSQM cost1200014000Fixed per warehouse
Problem formulaCost for storage/SQM sum of X/12000 sum of Y/14000Formula, which works fine when choosing one month but not when leaving month empty or multiple months
Correct formulaCost for storage/SQM- if 3 months chosen = (X/3) / SQM cost- if no months chosen = (Y/12) / SQM costSlicer needs to change the the Cost for storage/SQM formula to divide with count of how many months thats been chosen
1 ACCEPTED SOLUTION
AlexXandyr
Helper I
Helper I

I found a solution where I fixed the Cost for Storage part (making it an average based on the chosen month slicer), which then made the Cost per SQM calculation correct

Cost per Storage=
VAR _countofselmonth =
    CALCULATE ( DISTINCTCOUNT ( 'Calendar'[MonthName] ), ALLSELECTED ( 'Calendar' ) )
    RETURN
    DIVIDE (CALCULATE(sum(Actuals[Amount]),Actuals[Cost type] ="Cost for Storage"),  _countofselmonth )

View solution in original post

3 REPLIES 3
AlexXandyr
Helper I
Helper I

I found a solution where I fixed the Cost for Storage part (making it an average based on the chosen month slicer), which then made the Cost per SQM calculation correct

Cost per Storage=
VAR _countofselmonth =
    CALCULATE ( DISTINCTCOUNT ( 'Calendar'[MonthName] ), ALLSELECTED ( 'Calendar' ) )
    RETURN
    DIVIDE (CALCULATE(sum(Actuals[Amount]),Actuals[Cost type] ="Cost for Storage"),  _countofselmonth )
MFelix
Super User
Super User

Hi @AlexXandyr ,

 

Not sure if I understood the question correctly but you need to adjust your values for the fixed part to be over the full selected months something similar to:

 

Cost for Storage / SQM = DIVIDE ([Cost for Storage], SUMX((Calendar[Months], 12000)

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you, sorry for not being clear. Please see below where I try to explain in another way

The Cost per SQM is actually an average of the months chosen in the slicer. 

 

AlexXandyr_1-1714453798995.png

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.