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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to pull the data for specific Column?

arshey111_0-1654426103849.png

arshey111_0-1654629888743.png

Excel file 

 

I want to pull the data for the two measures. For the first measure, I want to pull the data for the past month from the 0th Column.  I created first measure1. And for the second measure, I want to pull from columns 1 to 12. For example, for the second measure, if I want to see the data for July month (199 in this case), it must show in the second column and respectively until December.  I unpivoted columns from 0 to 12. What DAX code do I need to use it here? So that I able to satisfy requirement

 
 
Measure1 =

CALCULATE(
SUM('Projektprognos (2)'[Value]),
FILTER('Projektprognos (2)', ([Attribute]<1)
)

)

@v-yanjiang-msft 

 

11 REPLIES 11
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,


Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

Best Regards
Lucien

lbendlin
Super User
Super User

First step is to unpivot your data to bring it into usable format.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Anonymous
Not applicable

Hello I unpivoted data in Power Bi still I am strugging for pulling the data. 

Please provide sanitized sample data that fully covers your issue.

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

Anonymous
Not applicable

I updated it with excel file in my post

First step:  unpivot.  Note that your first two columns are missing a column name so I excluded them

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\me\Downloads\excel.xlsx"), null, false),
    #"Projektprognos _sheet" = Source{[Item="Projektprognos ",Kind="Sheet"]}[Data],
    #"Removed Top Rows" = Table.Skip(#"Projektprognos _sheet", 1),
    #"Removed Columns" = Table.RemoveColumns(#"Removed Top Rows",{"Column1", "Column2", "Column18"}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Removed Columns", [PromoteAllScalars=true]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Typ", "Period"}, "Attribute", "Value"),
    #"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Value", Currency.Type}, {"Attribute", Int64.Type}, {"Period", type date}})
in
    #"Changed Type"

 

Now you can create your measures, one against Attribute 0 and the other against all other attributes.

Anonymous
Not applicable

Hello I already created unpivoted before. The only problem with the second measure I am getting. I am getting the wrong data.  I created measure1 for the 0th attribute.

Measure1 =

 

CALCULATE(
SUM('Projektprognos (2)'[Value]),
FILTER('Projektprognos (2)', ([Attribute]<1)
)

 

)

Measure1 = CALCULATE(sum('Projektprognos (2)'[Value]),'Projektprognos (2)'[Attribute]=0)
Measure2 = CALCULATE(sum('Projektprognos (2)'[Value]),'Projektprognos (2)'[Attribute]>0)

 

lbendlin_0-1654694820517.png

 

Anonymous
Not applicable

Thank you for the suggestion however measure2 I tried the same method however I cannot get these values in highlighted 

 

 

 

Please state your calculation rules again. I am not clear which rule should be applied for attribute 0 versus the other ones.

Anonymous
Not applicable

arshey111_0-1654708464772.png

I want pull always the data for 2022/05/23/(always from present date) the green highllighted from attribute 1 to 12. 2nd measure 

Measure2 = CALCULATE(sum('Projektprognos (2)'[Value]),'Projektprognos (2)'[Period]=2022-05-23) However it is not working to pull the data for attribute 1 to 9 on specific period 2022-05-23

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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