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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
erhan_79
Post Prodigy
Post Prodigy

Creating Table Based on Actual Month and Before Dates

Hi there ;

 

Could ypu pls help me to create a new table about below issue ;

 

I have table  A as below which includes "Material", "Delivery Date " and " Quantity" :

Capture2.JPG

 

 We will createa a new table , and in thşs table we will sum of the qty of the materials based on a date filtering , for new table  rules will be like that :

 

  • If the delivery date is in actual month and before actual month , system will sum that  quantities .For example today 15.01.2021 , actual month is January then , even there will be a date after 15.01.2021 but in January 2021 , it will be calculated , but if there will be a date after january 2021 (as above picture yellow marked = February 2021 ) system will not add to calculate this line .
  • If the delivery date will be blank , system will not calculate that quantity too.

 

So after these rules , i want a calculated table as below :

 

Capture1.JPG

  • For A material all quantities are  calculated because dates are in actual month
  • For B material one of the line's date is after actual month so system calculated only quantity = 40 's line 
  • For C material all quantities are  calculated because dates are in actual month
  • For D material one of the line's date is blank   so system calculated only quantity = 50 's line 

Also i share with you excel source with below link : 

https://drive.google.com/file/d/1apdTMsR2j2tnd0rzPLCEcb-iIoLSxsYm/view?usp=sharing

 

Thanks in advance for your kind supports 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @erhan_79 ,


According to your request, I have done the following test for reference. The calculated column is created for dynamic calculation. If the current month is February, the sum value corresponding to Material is "100".

C = 
CALCULATE (
    SUM ( 'Table'[Quantity] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Material] = EARLIER ( 'Table'[Material] )
            && 'Table'[Delivery Date] <> BLANK ()
            && (
                'Table'[Delivery Date] <= TODAY ()
                    || (
                        'Table'[Delivery Date] > TODAY ()
                            && MONTH ( 'Table'[Delivery Date] ) = MONTH ( TODAY () )
                    )
            )
    )
)

v-henryk-mstf_0-1612259797236.png

Here is the sample pbix file.

 

If the problem is still not resolved, please provide detailed error information and let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
v-henryk-mstf
Community Support
Community Support

Hi @erhan_79 ,


According to your request, I have done the following test for reference. The calculated column is created for dynamic calculation. If the current month is February, the sum value corresponding to Material is "100".

C = 
CALCULATE (
    SUM ( 'Table'[Quantity] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Material] = EARLIER ( 'Table'[Material] )
            && 'Table'[Delivery Date] <> BLANK ()
            && (
                'Table'[Delivery Date] <= TODAY ()
                    || (
                        'Table'[Delivery Date] > TODAY ()
                            && MONTH ( 'Table'[Delivery Date] ) = MONTH ( TODAY () )
                    )
            )
    )
)

v-henryk-mstf_0-1612259797236.png

Here is the sample pbix file.

 

If the problem is still not resolved, please provide detailed error information and let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@erhan_79 I don't see any reason to create a table or column when the above result can be easily achieved using the measure (as per my solution). There has to be a strong reason why someone needs a calculated column or calculated table in the model, and visualization is not a very strong reason. Just my 2 cents.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

VijayP
Super User
Super User

@erhan_79 

Answer is given in this file. Let me know if that suffice.

VijayP_0-1612111663949.png

 

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


dear @VijayP 

 

thanks for your reply but i wonder something , in your actual quantity formula you mentioned  " today" as i marked yellow. for example today was 01.02.2021 , and then actual month will be february , if there will be in the  delivery date  05.02.2021 tomorrow's report system should calculate too.But when you write the formula Today() , i could not be sure that you considered only date of today or all whoe month of january, also i can not test this situation because today is the last day of january .

 

maybe more clear like that to tell , imagine that today 30.01.2021 , and you sent me this formula and i changed the one of the delivery date to 31.01.2021 , so system will consider that changed date to 31.01.2021 's Lines's too ?

 

erhan_79_0-1612113023920.png

 

@erhan_79 

Instead of Today you can use Month(Delivery DAte) > Month(Today()) to avoid such issues.




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


ok @VijayP  , but when we do like that then previous years are not calculated , for previous years we need to add something too , 

 

Capture4.JPG

 

@VijayP , 

 

i try to tell that actual month is dynamic , when i open report in february actual month will be february , so all the delivery dates in february from 1 to 29 february will be the actual month statu whenever i check the report in february 

parry2k
Super User
Super User

@erhan_79 solution attached, if a date is selected in the slicer, it will sum qty on or before that date, if no date is selected then it will use TODAY() date.

 

You can tweak this solution as you see fit.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

hi @parry2k  

 

thank you very much for your suport but i need a calculated column , yours is measure 🙂

@erhan_79 why you want it as a column? What is the rationale behind it?

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k i want a new table ,as below , i have another formula which one is already created  for tables , and will work with below table 

 

Capture4.JPG

 

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.

Top Solution Authors