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,
I am trying to calculate the total quantity by Quality from a table called "Data", but filtering on the highest value in Period (in this case, 201906). The purpose is to calculate the variance for each quality (highest period/lowest period).
In other words, I would like to get for each product Quantity [Period 201906] / Quantity [Period 201902]
I have tried different formulas but I'm struggling with the filter context.
Can anyone help me?
Thanks!
Solved! Go to Solution.
How would you proceed, then, with Query M?
Thanks @Anonymous and @Greg for your solutions. My description of the issue is probably not accurate enough. What I am looking for is not retrieving the minimum quantity for each quantity. I want to retrieve the quantity for the Maximum value in "Period".
So for Quality "A", I want to retrieve the quantity where the value "Period" is the highest, so 10, not 13.
Then I would like to do the same for the minimum Period (so retrieve Quantity 5 for Quality A in @Anonymous 's example).
In the end, I would divide the Quantity for the highest Period by the Quantity for the lowest Period, for each Quality. That would give me an index, which is the scope of all the above.
I thought that DAX was the right language to solve this question but I didn't figure out how, despite may trials.
Thanks again for your help!
OK. So you need another table (created in PQ) that for each quality will store the quantities for the latest and oldest period.
I'll post a link to a file shortly.
Best
Dare
Yes, I think that should be a way to go. 🙂
Create a DAX formula that goes something like this:
Measure IsHighest =
VAR __table = SUMMARIZE(ALLSELECTED('Table'),[Quality], [Period],"__Quantity",SUM([Quantity]))
VAR __max = MAXX(__table,[__Quantity])
VAR __period = MAXX(FILTER(__table,[__Quantity] = __max),[Period])
RETURN
IF(MAX([Period]) = __period,1,0)
Then just fiilter on this being 1
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |