Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Show current year

I am preparing a header for my power bi report in the following way

 

Sales for the year 2020 - question is how do I show the year dynamically ? Can I add a new column to the report in the power bi desktop that just shows current year ?

  • Icey's avatar
    Icey
    5 years ago

    Hi Anonymous ,

     

    Try this:

    Measure =
    "My header -" & FORMAT ( TODAY (), "mmmyyyy" )
    

     

     

    Best regards

    Icey

     

    If this post helps, then consider Accepting it as the solution to help other members find it faster.

9 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Anonymous ,

     

    Perhaps a card with measure returning que current year works.

    Can you provide more details ?

    • Anonymous's avatar
      Anonymous
      Not applicable

      so here is the requirement, It doesnt have to do anything with the data, 

      In my power bi heading for the report, I just want to show below in the header of report whether there is data or not

       

      sales report - November 2020 

       

      The month and year should always show current month and year....thats all, nothing fancy, I can write oracle function to display this information in the oracle view i am using as source, but if there is no data for the month it would be empty....can I use dax somehow in the power bi header to show this info ? (maybe in a card ?) , dont want to invovle data table etc

  • Hi Anonymous 

    I'm not sure if you mean you want to show the current year i.e. 2020, or the currently selected year?

    And do you want the heading to read Sales for the year 2020 ?

    Please clarify.  If you just want the current year (2020) this measure will do

     

    Current Year = CONCATENATE("Sales for the Year ", FORMAT(TODAY(),"yyyy"))

     

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

    • Anonymous's avatar
      Anonymous
      Not applicable

      so here is the requirement, It doesnt have to do anything with the data, 

      In my power bi heading for the report, I just want to show 

       

      sales report - November 2020 

       

      The month and year should always show current month and year....thats all, nothing fancy, I can write oracle function to display this information in the oracle view i am using as source, but if there is no data for the month it would be empty....can I use dax somehow in the power bi header to show this info ? (maybe in a card ?) , dont want to invovle data table etc

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    Showing current year in header for report can be done with help if DAX measure and Card visual.

    DAX measure: 

    Report Header = "Sales for the year " & YEAR ( TODAY () )
     
    Please note doing this, only header will get the value for current year, and data will be shown as per the slicers selected.
    You can also think of using below DAX measure to dynamically change the year value in header, with change in the selected Year.
    DAX Measure:
    Report Header = "Sales for the year " & SELECTEDVALUE( 'Calendar'[Year] , "Multiple Years" )
     
    Romil

    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    Showing current year in header for report can be done with help if DAX measure and Card visual.

    DAX measure: 

    Report Header = "Sales for the year " & YEAR ( TODAY () )
     
    Please note doing this, only header will get the value for current year, and data will be shown as per the slicers selected.
    You can also think of using below DAX measure to dynamically change the year value in header, with change in the selected Year.
    DAX Measure:
    Report Header = "Sales for the year " & SELECTEDVALUE( 'Calendar'[Year] , "Multiple Years" )
     
    Romil

    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

    • Anonymous's avatar
      Anonymous
      Not applicable

      You mean create a new dax measure column which is static ?

    • Anonymous's avatar
      Anonymous
      Not applicable

      I am using card visual and a measure in the table, so good thing is, even though there is no data in the report I can see the header

       

      Measure = "My header -"& format(month(today()),"mmm") & year(today())
       
      why is it showing Jan2020 ? why not current month ?
      • Icey's avatar
        Icey
        Community Support

        Hi Anonymous ,

         

        Try this:

        Measure =
        "My header -" & FORMAT ( TODAY (), "mmmyyyy" )
        

         

         

        Best regards

        Icey

         

        If this post helps, then consider Accepting it as the solution to help other members find it faster.