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

Load data in table created from a list

Hello everyone,
Let's say I have a date table with a flag column that says if each year has to be considered for a specific analysis or not. 


From that point, what I want to do is take all the distinct values of year with the flag on, and create a new table on which I will load data from the cube.

My problem is that I don't know how to take only the distinct years matching the flag. And I don't know how to add data to the list created, even when I turn the list into a new Table.

Is there any way to do that ? 

10 REPLIES 10
Anonymous
Not applicable

Yes, I can do that. But then, I am not able to load more data.
I don't know how to have access to my cube from that point

Mikelytics
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

Can you please provide sample data?

Best regards

Michael

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
Anonymous
Not applicable

Hi Micheal, 
Yes sorry, it's better with an example.

Below is my date table with a time Period of the Analysis flag column that says wether or not the related year has to be considered for my next step. 

MattReal_0-1673257878815.png

 

The next step is, I want to create a new table with a Year column containing the distinct years matching my flag.

For now I create it with a list :

MattReal_1-1673258120617.png

Sorry for the French. It is the last option, something like Add as a new request

 

Then I have a list containing all the years. I have to filter it, then chnage type. But no way to add data to that table. The cube in the top left corner is not there..

MattReal_2-1673258374138.png

 

I hope my question is clearer now 🙂

 

 

 

 

Hi @Anonymous 

 

If I understand I would to the following. Please be aware tha in my smaple I have no flag column so you habe to do the filter in step two which you do not see in my screenshots.

 

1) Create a separate query by referencing to your orignial one

Mikelytics_0-1673342499960.png

2) in the new query filter the data by the flag column, then remove all the other columns and the remove the duplicates

Mikelytics_1-1673342690559.png

the you should have the table in a seperate query which you can re-use

Mikelytics_2-1673342717420.png

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
Anonymous
Not applicable

Hi @Mikelytics,

Thank you for your message. All the steps are good so far. But my problem now is to be able to connect to a cube in order to load more data.
Not sure if I'm right, but if I have the Table icon in the top left corner of my Table, I cannot load more data from a Cube. If I have the Cube icon, I can.

MattReal_0-1673355840938.png

vs 

MattReal_1-1673355878617.png


Is there a way to load data from the cube anyway ?

Hi @Anonymous 

 

1) what you see in Power Query is only a preview of the data so when you implement the logic and you click on close and apply all the data from the data source wille be loaded so that you can see the data in the data model and data view in Power BI Desktop

 

2) So when you work with cubs as a data source you typicall hav to expand the data to get all of it in detail. in Power Query. Unfortunately I have no cube on my side to show it to you but there are way by clicking or by specific Power Query formulas to expand the data of a cube to the lowest level and by that to get all data which is available from the data source.

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
Anonymous
Not applicable

Hi @Mikelytics,

thank you for the answer. But I'm not sure we are talking about the same thing.

Let me take an example to illustrate my problem.

I have a date table with a date column containing all the dates from 01/01/2020 till 31/12/2023.
The next column is the Year column with only the years.

Let's forget about the filtering on years.

What I want to do now, is take all distinct years and create a new table with it.
Then, I want to connect to a table in a cube and load all the rows where years match.

I hope my example is understandable.

Maybe I'm taking the problem upside down..

Can you just filter your original table based on the flag?  Or, without even using a flag, filter based on the desired year?

Anonymous
Not applicable

No I cannot filter my original table as I want to keep a single date table for both my periods of analysis. 
Basically, I want to say, If the year in my Date table is a flagged year, I want to put it in a new table. Once all the flagged years are in the new table, I want to add data from a cube for the matching years 

In Power Query, I believe, in order to retain your original table, and also have a second table, you will need to have a second query.  For the second query, something like:

let
//This will return the last step of your query with a full table
    Source = NameOfFirstQuery,
//then filter either by Year or by Flag
    #"Filtered Table" = Table.SelectRows(Source, each [Year] = 2021)
in
    #"Filtered Table" 

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.

Top Solution Authors
Top Kudoed Authors