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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
iteety
Regular Visitor

How to create daily data from MTD data?

Dear All,

 

I got a salesman outlet visit data as MTD which is accumulated daily. How could I create new column or use DAX formula for salesman outlet daily visit? (calculation is outlet_visit_MTD(day n) minus outlet_visit_MTD(day n-1) by salesman) Here is example of the data below. I got the data from the 1st 3 columns and wish to create the 4th column.

 

Thank you in advanced!

iteety_0-1682051938816.png

 

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

Pay attention to the situation that there are gaps between dates.

Daily.pbix

 

ThxAlot_0-1682060815474.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @iteety ,

you may try to add a calculated column like:

Daily2 = 
VAR _yyyymmdd = [yyyymmdd] 
VAR _mtdpre = 
    CALCULATE(
        MAX(data[MTD]),
        ALLEXCEPT(data, data[SalesKey]),
        data[yyyymmdd]< _yyyymmdd
    )
RETURN [MTD]-_mtdpre

or 

Daily3 = 
VAR _yyyymmdd = [yyyymmdd] 
VAR _saleskey = [saleskey]
VAR _mtdpre =
MAXX(
    FILTER(
        data,
        data[saleskey]=_saleskey
            &&data[yyyymmdd]<_yyyymmdd
    ),
    data[MTD]
)
RETURN 
    [MTD] - _mtdpre

 

they worked like:

FreemanZ_0-1682066571101.png

ThxAlot
Super User
Super User

Pay attention to the situation that there are gaps between dates.

Daily.pbix

 

ThxAlot_0-1682060815474.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Mahesh0016
Super User
Super User

@iteety Please try this
calculate(TOTALMTD(SUM(outlet_visit_MTD(day n)),outlet_visit_MTD[yyyyMMdd]),ALLEXCEPT(outlet_visit_MTD,outlet_visit_MTD[Saleskey]))

@iteety if this helps you please mark as a solutions.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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