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.
Hello Power BI community,
I have the data in the following format.
Products Inv Days
A 39
B 101
C 55
D 40
E 60
F 30
I want to create 3 cards.
1) count when inv. days<=40
2) count when inv. days >40 and <=60
3) count when inv. days > 60
I tried
low inv = IF(Table[inv. days] <41,1,0) and then in a card, I would add the sum of the low inv. but it is giving me the count of total rows instead.
Help will be appreciated.
Solved! Go to Solution.
@Anonymous I think @amitchandak means COUNTX not SUMX
countx(filter(summarize(Table,Table[Products],"_1",[Inv Days]),[_1]<=40),[Products])
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
As discussed use a common dimension.
Countx(filter(summarize(Table,Products[Products],"_1",[Inv Days]),[_1]<=40),[Products])
You can try how
calculate(count(Table[Products]), Tabla[Inv Days]<-40)
calculate(count(Table[Products]), Table[Inv Days]>-40 && Table[Inv Days]<-60)
calculate(count(Table[Products]), Tabla[Inv Days]>-60)
Or just create a count measure and use the visual level filter
count(Table[Products])
https://docs.microsoft.com/en-us/power-bi/power-bi-report-filter
You can also use distinctcount,if necessary, instead of counting
You can try how
calculate(count(Table[Products]), Tabla[Inv Days]<-40)
calculate(count(Table[Products]), Table[Inv Days]>-40 && Table[Inv Days]<-60)
calculate(count(Table[Products]), Tabla[Inv Days]>-60)
Or just create a count measure and use the visual level filter
count(Table[Products])
https://docs.microsoft.com/en-us/power-bi/power-bi-report-filter
You can also use distinctcount,if necessary, instead of counting
@amitchandak Thanks for the response. I am getting the following error.
A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
@Anonymous , You may have try like
calculate(count(Table[Products]),filter(Table, Table[Inv Days]<=40))
calculate(count(Table[Products]),filter(Table, Table[Inv Days]>=40 && Table[Inv Days]<=60))
calculate(count(Table[Products]),filter(Table, Table[Inv Days]>=60))
May be values or summarize too
calculate(countX(values(Table[Products]),Table[Products]),filter(Table, Table[Inv Days]<=40))
@Anonymous
Other than what I have given in the last update, if Inv Days is a measure , you may have to change all of them like this
sumx(filter(summarize(Table,Table[Products],"_1",[Inv Days]),[_1]<=40),[Products])
For the last comment, I am getting this error.
"Function SumX can not work with value type "string".
As discussed use a common dimension.
Countx(filter(summarize(Table,Products[Products],"_1",[Inv Days]),[_1]<=40),[Products])
@Anonymous I think @amitchandak means COUNTX not SUMX
countx(filter(summarize(Table,Table[Products],"_1",[Inv Days]),[_1]<=40),[Products])
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Yes, inv day is a measure. Probably that is why it wasn't moving forward. Let me try this.
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |