Forum Discussion

gantaran's avatar
gantaran
Regular Visitor
1 year ago
Solved

Month-to-Date Daily Bar Chart

I'd like to show the MTD daily sales in a bar chart.  For example, if I select the date Sept 15, 2024, the visual will show the daily sales from Sept 1 to 15.  How do I do that?

  • lbendlin's avatar
    lbendlin
    1 year ago

     

    Net Gen YTD = 
    var d = max('Calendar'[Date])
    var fd = max('Table'[Date])
    return if(format(fd,"mmdd")<=format(d,"mmdd") && year(fd)=year(d),SUM('Table'[Net Generation]))

     

7 Replies

  • Have you tried to use a Quick Measure? They have patterns for that.

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

    Please show the expected outcome based on the sample data you provided.

    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    • gantaran's avatar
      gantaran
      Regular Visitor

      Here's the sample data.

       

      Source.NameDatePlant UnitNet Generation
      240701_IPP.csv07/01/2024PLANT18100.876
      240702_IPP.csv07/02/2024PLANT16096.528
      240703_IPP.csv07/03/2024PLANT18507.088
      240704_IPP.csv07/04/2024PLANT13133.128
      240705_IPP.csv07/05/2024PLANT17911.468
      240706_IPP.csv07/06/2024PLANT17960.536
      240707_IPP.csv07/07/2024PLANT17956.636
      240708_IPP.csv07/08/2024PLANT110809.6
      240709_IPP.csv07/09/2024PLANT111378.076
      240710_IPP.csv07/10/2024PLANT16898.116
      240711_IPP.csv07/11/2024PLANT17963.404
      240712_IPP.csv07/12/2024PLANT18045.604
      240713_IPP.csv07/13/2024PLANT18801.148
      240714_IPP.csv07/14/2024PLANT18004.972
      240715_IPP.csv07/15/2024PLANT18893.236
      240716_IPP.csv07/16/2024PLANT19182.988
      240717_IPP.csv07/17/2024PLANT19856.368
      240718_IPP.csv07/18/2024PLANT111901.648
      240719_IPP.csv07/19/2024PLANT114123.724
      240720_IPP.csv07/20/2024PLANT114073.456
      240721_IPP.csv07/21/2024PLANT114086.476
      240722_IPP.csv07/22/2024PLANT113845.252
      240723_IPP.csv07/23/2024PLANT113651.488
      240724_IPP.csv07/24/2024PLANT17933.74
      240725_IPP.csv07/25/2024PLANT17962.516
      240726_IPP.csv07/26/2024PLANT17968.432
      240727_IPP.csv07/27/2024PLANT17943.352
      240728_IPP.csv07/28/2024PLANT17917.732
      240729_IPP.csv07/29/2024PLANT18225.088
      240730_IPP.csv07/30/2024PLANT19136.428
      240731_IPP.csv07/31/2024PLANT19829.529033
      240801_IPP.csv08/01/2024PLANT18892.744
      240802_IPP.csv08/02/2024PLANT18871.216
      240803_IPP.csv08/03/2024PLANT17885.212
      240804_IPP.csv08/04/2024PLANT19700.008
      240805_IPP.csv08/05/2024PLANT113981.548
      240806_IPP.csv08/06/2024PLANT114025.168
      240807_IPP.csv08/07/2024PLANT114000.76
      240808_IPP.csv08/08/2024PLANT113938.684
      240809_IPP.csv08/09/2024PLANT113902.528
      240810_IPP.csv08/10/2024PLANT113899.024
      240811_IPP.csv08/11/2024PLANT113932.72
      240812_IPP.csv08/12/2024PLANT113915.788
      240813_IPP.csv08/13/2024PLANT113893.06
      240814_IPP.csv08/14/2024PLANT113931.328
      240815_IPP.csv08/15/2024PLANT113917.48
      240816_IPP.csv08/16/2024PLANT113922.604
      240817_IPP.csv08/17/2024PLANT113864.608
      240818_IPP.csv08/18/2024PLANT113880.796
      240819_IPP.csv08/19/2024PLANT113934.592
      240820_IPP.csv08/20/2024PLANT113928.82
      240821_IPP.csv08/21/2024PLANT113944.204
      240822_IPP.csv08/22/2024PLANT113938.504
      240823_IPP.csv08/23/2024PLANT113837.86
      240824_IPP.csv08/24/2024PLANT113869.996
      240825_IPP.csv08/25/2024PLANT113872.504
      240826_IPP.csv08/26/2024PLANT113822.596
      240827_IPP.csv08/27/2024PLANT113795.524
      240828_IPP.csv08/28/2024PLANT113746.492
      240829_IPP.csv08/29/2024PLANT113799.412
      240830_IPP.csv08/30/2024PLANT113790.76
      240831_IPP.csv08/31/2024PLANT113818.948
      240901_IPP.csv09/01/2024PLANT113782.096
      240902_IPP.csv09/02/2024PLANT113766.628
      240903_IPP.csv09/03/2024PLANT113759.2
      240904_IPP.csv09/04/2024PLANT113788.804
      240905_IPP.csv09/05/2024PLANT113820.676
      240906_IPP.csv09/06/2024PLANT113759.2
      240907_IPP.csv09/07/2024PLANT113824.312
      240908_IPP.csv09/08/2024PLANT113827.816
      240909_IPP.csv09/09/2024PLANT113827.588
      240910_IPP.csv09/10/2024PLANT113793
      240911_IPP.csv09/11/2024PLANT113811.34
      240912_IPP.csv09/12/2024PLANT113797.48
      240913_IPP.csv09/13/2024PLANT112163.92
      240914_IPP.csv09/14/2024PLANT17247.179707
      240915_IPP.csv09/15/2024PLANT17965.06
      240916_IPP.csv09/16/2024PLANT17983.804
      240917_IPP.csv09/17/2024PLANT17977.432
      240918_IPP.csv09/18/2024PLANT17955.76
      240919_IPP.csv09/19/2024PLANT18068.032
      240920_IPP.csv09/20/2024PLANT17964.628
      240921_IPP.csv09/21/2024PLANT17869.156
      240922_IPP.csv09/22/2024PLANT16842.448
      240923_IPP.csv09/23/2024PLANT18127.228
      240924_IPP.csv09/24/2024PLANT18148.468
      240925_IPP.csv09/25/2024PLANT18930.34
      240926_IPP.csv09/26/2024PLANT18996.472
      240927_IPP.csv09/27/2024PLANT110529.904
      240928_IPP.csv09/28/2024PLANT113378.644
      240929_IPP.csv09/29/2024PLANT110730.532
      241001_IPP.csv09/30/2024PLANT17968.408
      240801_Ilijan.csv08/15/2024PLANT113917.48

       

      The expected visual should be:
      If I select the date July 15, 2024, it will show a bar graph showing 15 bars representing the net generation values from July 1 to 15.  If I select Aug 7, it will show a bar graph showing 7 bars representing the net generation values from Aug 1 to 7. 

  • gantaran's avatar
    gantaran
    Regular Visitor

    Hi, can you also help me with another visual showing YTD daily values?  that is, if I select Aug 7, it will show cumulative values from Jan 1 to Aug 7. you may use the same sample data.  

    • lbendlin's avatar
      lbendlin
      Super User

       

      Net Gen YTD = 
      var d = max('Calendar'[Date])
      var fd = max('Table'[Date])
      return if(format(fd,"mmdd")<=format(d,"mmdd") && year(fd)=year(d),SUM('Table'[Net Generation]))