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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.