Forum Discussion
Power query - Counting rows from all table in query editor but not shows data in the model tab
Hi, thanks for trying to help me.
Im going to explain every step that I did:
I create two excel files and Import the files in power bi:
So, I create a empty query and edit the query :
let
Source = #shared,
#"Converted to Table" = Record.ToTable(Source),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each Type.Is(Value.Type([Value]),Table.Type) and [Name] <> "Consulta1"),
#"Consolidate Table" = Table.AddColumn(#"Filtered Rows", "Column", each Table.RowCount([Value]) ),
#"Value Expandido" = Table.ExpandTableColumn(#"Consolidate Table", "Value", {"Field1", "Field2"}, {"Value.Field1", "Value.Field2"})
in
#"Value Expandido"
The first line:
Source = #shared,
Take all variables used by power bi, tables imported, function, etc.
The next step I convert to a table
#"Converted to Table" = Record.ToTable(Source),
Then, I filter only the variables wich is the type of table. I need to remove the table related to the query I made, in my case the query has the name "Consulta1".
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each Type.Is(Value.Type([Value]),Table.Type) and [Name] <> "Consulta1"),
I get the tables and calculate the row count
#"Consolidate Table" = Table.AddColumn(#"Filtered Rows", "Column", each Table.RowCount([Value]) ),
Then I tried your suggest, expanding the column, but not worked for me.
#"Value Expandido" = Table.ExpandTableColumn(#"Consolidate Table", "Value", {"Field1", "Field2"}, {"Value.Field1", "Value.Field2"})
But when I switched to model, any data appear:
Hi, mrfazio
Is there any error message with these steps? What is the result for the query?
Best Regards
Allan
- mrfazio6 years agoNew Member
Hi,
It shows the results when I transform the data, but when I apply the changes I cannot manipulate the data in report because it not shows the data that was tranformed.
- Smauro6 years ago
Solution Sage
You're not missing anything, it's just reference and context.
When in PQ Editor, you are referencing all your queries via #shared. This works, because at this time all your queries are computed, and ready to be referenced on a new query. However, when applying changes, Consulta1 query gets only the direct references of Consulta1 (and all functions) from #shared, and since all other queries are never directly referenced, and probably not even calculated at the time of Consulta1's calculation, they are simply not there. Thus, an empty table.Edit: You can see that on Query Dependencies