Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi everyone,
I am looking for a solution to add new rows to my dataset.
For each Month of each value of [Country Name], I need to ensure that there is a row where [Business] = "Mining". If it does not in dataset, I need to add a new one. As in the picture below, there is row for every month of Country1, but only row for January and December of Country2. So I need to add more 10 rows (from February to November). However, it possibly required 3 or different number of rows for other [Country Name] value, or might be none (if like Country1).
I tried to divide this problem into small steps, both in Power Query or DAX, but till now I cannot find any reasonable solution.
Any help from you would be so valuable to me!
Thank you!
Solved! Go to Solution.
Hi @Anonymous
In Edit queries, i create a date table as below
enter dates in box "startdate" and "enddate", then "Invoke", we can get a new table, renamed it as "date",
Then in your table, if you only have three columns, group data as below,
Then add a custom column and expand
Hi @Anonymous
In Edit queries, i create a date table as below
enter dates in box "startdate" and "enddate", then "Invoke", we can get a new table, renamed it as "date",
Then in your table, if you only have three columns, group data as below,
Then add a custom column and expand
@v-juanli-msft thank you Juan li, there are much power query techniques on it and I have learned a lot. Very sorry for the late reaction.
Hi @Anonymous ,
I think the easiest solution is the generate a new table in DAX with all the necessary rows.
You can create a new calculated table in Power BI with the following formula:
Country by month table = GENERATEALL(VALUES(Table1[Country Name]),VALUES(Table1[Calendar]))You can then add columns to this new table and copy there any values from your previous table.
Does this help you?
LC
Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 67 | |
| 66 | |
| 31 | |
| 28 | |
| 24 |