Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
Please please help me out with this. So this is my table (made using the power BI visual matrix). The rows are IDs and the columns are Dates, usually a week apart (but not always). The values are sum of the quantity of each ID (PDQ). I want to count the number of IDs, which have at leaste ONE change across these 8 weeks.
SKU | 1/6/2021 | 1/13/2021 | 1/20/2021 | 1/27/2021 | 2/3/2021 | 2/10/2021 | 2/17/2021 | 2/24/2021 |
A | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
B | 2 | 2 | 3 | 3 | 3 | 3 | 1 | 1 |
C | 3 | 3 | 4 | 4 | 5 | 5 | 5 | 4 |
D | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 2 |
E | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
F | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
G | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
H | 4 | 4 | 5 | 5 | 5 | 5 | 5 | 5 |
I | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
J | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
K | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
L | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
M | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
I have a measure which calculates the previous week's PDQ:
lastpdq =
var latestDate = MAX(Append1[MinDate])
VAR prevDate = CALCULATE(MAX(Append1[MinDate]),Append1[MinDate]<latestDate,ALLSELECTED(Append1[MinDate]))
RETURN
CALCULATE(
SUM(Append1[PDQ]),
Append1[MinDate]=prevDate, ALLSELECTED(Append1[MinDate]))
Using this I calculated the Variance between previous and current week. I used this to apply condiitional formatting as well and it works perfectly fine.
I tried using this (and much more) to get the count, but nothing is working:
Count = CALCULATE(
COUNTROWS( SUMMARIZE( Append1, Append1[SELL_ID] )),
FILTER( SUMMARIZE( Append1,Append1[SELL_ID] ),[Variance]>0||[Variance]<0))
Solved! Go to Solution.
Hi @ET1995 ,
Use something like:
Count IDs changed at least once =
VAR a =
ADDCOLUMNS (
SUMMARIZE ( 'Table', 'Table'[SKU] ),
"VALUE",
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
FILTER (
SUMMARIZE (
'Table',
'Table'[SKU],
'Table'[Date],
"PDQ", COUNT ( 'Table'[SKU] )
),
'Table'[SKU] = EARLIER ( 'Table'[SKU] )
),
"VAUE1", [PDQ]
)
)
)
)
RETURN
COUNTX ( FILTER ( a, [VALUE] >= 2 ), 'Table'[SKU] )
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @ET1995 ,
Use something like:
Count IDs changed at least once =
VAR a =
ADDCOLUMNS (
SUMMARIZE ( 'Table', 'Table'[SKU] ),
"VALUE",
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
FILTER (
SUMMARIZE (
'Table',
'Table'[SKU],
'Table'[Date],
"PDQ", COUNT ( 'Table'[SKU] )
),
'Table'[SKU] = EARLIER ( 'Table'[SKU] )
),
"VAUE1", [PDQ]
)
)
)
)
RETURN
COUNTX ( FILTER ( a, [VALUE] >= 2 ), 'Table'[SKU] )
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi, @ET1995
Please check the below picture and the sample pbix file's link down below.
All measures are in the sample pbix file. And all steps are numbered in front of each measure.
https://www.dropbox.com/s/h2grahj4hvbmm90/et1995.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |