Forum Discussion
Help, how d I get % change?
https://drive.google.com/file/d/1xWl-pLZ3m6xinlepSwWI1j7mRxaTJjxl/view?usp=sharing
Thanks, I want to get the change from the 5.20 elite to 5.21 elite in the PF elite and QF elite sheets and then figure out how i can seperate the states so I can add visuals of by region
- richbenmintz5 years ago
Resident Rockstar
Hi bv27718n,
Looking at your file, you do not need the relationship between the Elite 20 and 21 tables.
Below is a formula that will create a new column in your table with the other tables value
PF Life 2020 col = VAR _state = 'Elite 5.21'[State] return CALCULATE(MAX('Elite 5.20'[PF life]), FILTER('Elite 5.20', 'Elite 5.20'[State] = _state))you can then create the following measures to get the sums and variance
PF Life 2020 = SUM('Elite 5.21'[PF Life 2020 col]) pf life 2020 var = sum('Elite 5.21'[PF Life]) - sum('Elite 5.21'[PF Life 2020 col])Result would look like this
I have attached your file with my mods
To slice by Region, you will need to create a region table that contains each state and region then relate the table to the fact tables on the state. You will then use the the region to filter and slice your data.
Please review the following Microsoft docs for best practices for data modelling
https://docs.microsoft.com/en-us/power-bi/guidance/star-schema
I would also suggest that you store your facts in a single fact table with a period column to define the period that the fact belongs to rather than creating tables for each year, it is not a manageble or extensible solution.
Thanks,
- bv27718n5 years ago
Helper II
Okay, makes sense. I appreciate your help. I did have one last follow up, I am looking at what you did, how do you then add in the other colums likethe PF 2020? I would go into the elite 2020, create columns say for gold patron and patron and then go from there I take it.
Is there an easy way to create a "state region" table? where is that created?
- richbenmintz5 years ago
Resident Rockstar
Hi bv27718n ,
Follow the exact same pattern, create column in the table where the variance is by looking up the value from the corresponding table, then add your measures.
For the State Region Table you could use this csv and import into your model
- bv27718n5 years ago
Helper II
awesome and for that table, is there anything that should be linked or any other steps to pull that info in?
- richbenmintz5 years ago
Resident Rockstar
Hi bv27718n ,
Import the file into your Power BI Data Model and relate the table to your facts on the state column
- bv27718n5 years ago
Helper II
Awesome, thanks! So, I just continue to do that and I can add in a percent change column as well. How come you do not need the relationship there? I thought you did.
- richbenmintz5 years ago
Resident Rockstar
Hi bv27718n,
The Facts really are not related, you could have related on State 1 to 1 but that was not the case