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

how to calculate total daily rental

Hi, I am needing to show total daily charge. I have manually calculated to show the results I am needing - on Jan 1, our total rental items billed = $400 but on Jan 4, it was only $100. What is the best way to calculate daily total? Appreciate any help. Thank you in advance.

 

wotkara_0-1713928541267.png

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1713933441147.png

 

 

Jihwan_Kim_0-1713933418042.png

 

 

total charge measure: = 
VAR _t =
    ADDCOLUMNS ( data, "@rentdays", DATEDIFF ( data[start], data[stop], DAY ) + 1 )
VAR _daiylycharge =
    ADDCOLUMNS ( _t, "@dailycharge", DIVIDE ( data[total charge], [@rentdays] ) )
VAR _dailytable =
    ADDCOLUMNS (
        'calendar',
        "@dailycharge",
            SUMX (
                FILTER (
                    _daiylycharge,
                    data[start] <= EARLIER ( 'calendar'[Date] )
                        && data[stop] >= EARLIER ( 'calendar'[Date] )
                ),
                [@dailycharge]
            )
    )
RETURN
    SUMX ( _dailytable, [@dailycharge] )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
spirit0talespin
New Member

hi @wotkara 

 

I have used below tables

Inv

spirit0talespin_0-1713934777852.png

 

Chg

spirit0talespin_1-1713934816520.png

 

Calendar table

Calendar =
VAR _minDate = MIN(Inv[START])
VAR _maxDate = MAX(Inv[STOP])

RETURN CALENDAR( _minDate, _maxDate)
 
Datamodel
spirit0talespin_2-1713934855497.png

 

 

Measure

-----------------

Total Charge =
VAR _SelDate = SELECTEDVALUE('Calendar'[Date])

RETURN
SUMX( Inv,
IF(
Inv[START] <= _SelDate && Inv[STOP] >= _SelDate,
RELATED(Chg[CHARGE]),
0
)
)
 
spirit0talespin_3-1713934915553.png

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1713933441147.png

 

 

Jihwan_Kim_0-1713933418042.png

 

 

total charge measure: = 
VAR _t =
    ADDCOLUMNS ( data, "@rentdays", DATEDIFF ( data[start], data[stop], DAY ) + 1 )
VAR _daiylycharge =
    ADDCOLUMNS ( _t, "@dailycharge", DIVIDE ( data[total charge], [@rentdays] ) )
VAR _dailytable =
    ADDCOLUMNS (
        'calendar',
        "@dailycharge",
            SUMX (
                FILTER (
                    _daiylycharge,
                    data[start] <= EARLIER ( 'calendar'[Date] )
                        && data[stop] >= EARLIER ( 'calendar'[Date] )
                ),
                [@dailycharge]
            )
    )
RETURN
    SUMX ( _dailytable, [@dailycharge] )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you so much! This worked. I greatly appreciate your help 🙂

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.