Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
For some reason a measure in a matrix will only show data in the measures column, if there is data present in another column. As an example (file attached), for Croatia, although they have 1 laptop available and should show in the "Running Total Stock" column for Jan & Feb, it doesnt until March, when there is 1 "Predicted Headcount" entry.
How can it get it to show the stock in all months?
Find an example pbix file: Example File (Correct one now)
Solved! Go to Solution.
Hi @StuartSmith ,
Try to remake you measure for the stock after to :
Stock_After_Onboarding_Measure V2 =
[Running_Total_Stock_After_Onboarding_Measure] - [Predicted_Headcount_Measure]
Result attach:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @StuartSmith ,
The question on this calculation is that you are picking up the values where the date is before the minimum date.
What is the expected result you want to have?
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsSorry, i uploaded the wrong screenshot and file. Now corrected both. As you can see for Belgium, in Jan there are 7 Laptops and 4 new starters, leaving 3 laptops. Then for Feb, there are 3 Laptops and 3 New Starters leaving 0 remainin laptops, and this works through the year.
For Croatia, although there is 1 laptop available, it only shows that 1 laptop once a new starter is present in March. What it should be showing is Jan: Available 1, Headcount 0, after onboarding 1, then the same for Feb, and then in March, as it displays.
Hope that makes sense
Hi @StuartSmith ,
Your issue is regading the relationships and the wqay you have your model setup., many-to-many relationship witha filter for both sides can always bring you incorrect results, in this case I have solved making two changes to your model:
Running_Total_Stock_After_Onboarding_Measure =
Var Reuse_and_New_Stock_Count = COUNTROWS('Reuse & New Stock') + 0
Var Total_laptop_Stock = Reuse_and_New_Stock_Count
Var Headcount_Running_Total = CALCULATE (COUNTROWS ( 'HR Data' ),FILTER ( ALLSELECTED ( Dates ), Dates[Date] < MIN( Dates[Date] ) ))
Return
Total_Laptop_Stock - Headcount_Running_Total +0
Be aware that in this measure I have replaces the MIN that was getting the value from the HR table to the Dates table (since this is the table used on the visualization and also on the one side of the relatioship.
Final result below and in attach PBIX file:
Check this video of Marco Russo with explanation about the many to many relationship.
https://www.youtube.com/watch?v=wRSJ6TYjEu0
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks, that seems to have done the trick. I then tried to create 4 yearly quarter tabs for ...
Jan, Feb, Mar
Apr, May, June
July, Aug, Sept
Oct, Nov, Dec
and create a page filter for each page with the above months, hoping it would provide a running total split into quarters, but the "Available Laptop Stock" value resets for each tab and shows, as an example of Belgium "7", when at the end of Q1 the laptop count was -11, and therefore Q2 April should be -11, then July should be -32, etc. But they all show 7. The other 2 columns work fine.
I am tryng to figure this out, but my test measures have about 10 lines of code, where I can getting the headcount for all the previous months, and trying to perform some from a calculation, but im sure there us a more effecient way.
Hope that makes sense and have added an update file with the quarter tabs.
Thanks in advance,
Hi @StuartSmith ,
Has refered by @v-easonf-msft if you replace the ALLSELECTED by ALL then you get the expected result.
Q3
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks Both, I had tried that and the calculation works fine until you get a "Predicted Headcount" value of "0" and then the measure breaks. This happens on the example file and my working file. As an example Belgium works fine until Aug and then when there is 0 "Predicted Headcount", instead of "Stock After Onboarding" having the value of "-35", it has "7" and the same for Croatia, "Stock after Onboarding" should be "-2", but showing "1"?
Any ideas? Thanks in advance.
And if I add an entry for Aug for Belgium, it corrects the error, but if the headcount is 0, the measure breaks.
Hi @StuartSmith ,
Try to remake you measure for the stock after to :
Stock_After_Onboarding_Measure V2 =
[Running_Total_Stock_After_Onboarding_Measure] - [Predicted_Headcount_Measure]
Result attach:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks for all your help with this and now everything is working perfectly.
Hi, @StuartSmith
If I understand correctly, you can try to use 'All' to replace 'Allselected' in measure 'Running_Total_Stock_After_Onboarding_Measure'.
Running_Total_Stock_After_Onboarding_Measure =
Var Reuse_and_New_Stock_Count = COUNTROWS('Reuse & New Stock') + 0
Var Total_laptop_Stock = Reuse_and_New_Stock_Count
Var Headcount_Running_Total = CALCULATE (COUNTROWS ( 'HR Data' ),FILTER ( ALL( Dates ), Dates[Date] < MIN( Dates[Date] ) ))
Return
Total_Laptop_Stock - Headcount_Running_Total +0
Best Regards,
Community Support Team _ Eason
Thanks, thats great and much appreciated that you took the time to help. I'm just going through your alterations now on the actual report and will then double check the results, but on initial inspection, it all looks good. I must admit I had used a "Bridge" table before, but had forgot about it. Will accept solution once tested.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
82 | |
67 | |
61 | |
46 | |
45 |