0

I have an excel sheet where users maintain data format month wise. every new month the add a column with some prefix and maintain the format. like for this month they will add the column name "OCT_Data_Format". Please see the below screenshot.

enter image description here

Again in December they'll add a new column with new name "DEC_data_format".

I want to add a custom column with name "DataFormat" and use the value of new column in every month.

Requesting you to please let me know if there is any function available in power bi to concatenate the month name with prefix "_data_format".

like we do in programming. ex. [function.getcurrentmonthname + "_data_format"].value

2
  • I think, you can use DAX function to solve this. Commented Nov 14, 2019 at 6:50
  • @ProtapGhosh the same i want to know. Commented Nov 14, 2019 at 6:55

2 Answers 2

1

Concatenating the name of the column based by current month "name" (it's not the full name to be precise) can be made like this (in DAX):

SWITCH (
    MONTH ( TODAY() ),
    1, "Jan",
    2, "Feb",
    3, "Mar",
    4, "Apr",
    5, "May",
    6, "Jun",
    7, "Jul",
    8, "Aug",
    9, "Sep",
    10, "Oct",
    11, "Nov",
    12, "Dec"
) & "_Data_Format"

But what you need is to unpivot your table and get all months data into two columns - Attribute and Value, where the values in attribute will be the names of the old columns and you can use standard filtering to find what you are looking for.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi @Andrey Nikolov , The column name was successfully concatenated but it is returning the column name in values too. i want to retrieve the column value by concatenating the column name. Please see the result . ibb.co/dbYm6Hd
@ShahabHaidar That's why I told you to unpivot the table.
0

This may solve your problem:

CONCATENATE( SWITCH( [MONTH(NOW())], 1, "JAN", 2, "FEB", 3, "MAR", 4, "APR"  
               , 5, "MAY", 6, "JUN", 7, "JUL", 8, "AUG"  
               , 9, "SEP", 10, "OCT", 11, "NOV", 12, "DEC"  
               , "Unknown month number" ), "_data_format" )
  1. https://learn.microsoft.com/en-us/dax/concatenate-function-dax
  2. https://learn.microsoft.com/en-us/dax/month-function-dax
  3. https://learn.microsoft.com/en-us/dax/switch-function-dax

1 Comment

Hi @Protap Ghosh , The column name was successfully concatenated but it is returning the column name in values too. i want to retrieve the column value by concatenating the column name. Please see the result . ibb.co/dbYm6Hd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.