The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a table like this : I wanted to know the number of storage connected to VM ( Datastore name contains the storage name )
Server Name | Datastores.1.1 | Datastores.2.1 | Datastores.3.1 | Datastores.4.1 | Datastores.5.1 | Datastores.6.1 | Datastores.7.1 | Datastores.8.1 |
VM1 | PureStorage05 | PureStorage05 | PureStorage05 | PureStorage02 | PureStorage02 | PureStorage02 | PureStorage05 | PureStorage05 |
VM2 | PureStorage05 | PureStorage02 | PureStorage05 | PureStorage05 | PureStorage05 | PureStorage05 | PureStorage02 | PureStorage02 |
VM3 | InfiniStorage09 | PureStorage06 | PureStorage06 | PureStorage06 | PureStorage01 | PureStorage01 | PureStorage06 | PureStorage06 |
I am looking for an output like this :
Server_Name | No_of_Storage_connected | StorageArray |
VM1 | 2 | PureStorage05 ,PureStorage02 |
VM2 | 2 | PureStorage05 ,PureStorage02 |
VM3 | 3 | InfiniStorage09,PureStorage06,PureStorage01 |
Could you please help me to find a way to do this ?
Solved! Go to Solution.
@Saul_K tweak the measure to filter out N/A:
Storage Count =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
COUNTROWS ( FILTER ( __Table, [Datastores.1.1] <> "N/A" ) )
Storage Array =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
CONCATENATEX ( FILTER ( __Table, [Datastores.1.1] <> "N/A" ), [Datastores.1.1], "," )
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.
@Saul_K tweak the measure to filter out N/A:
Storage Count =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
COUNTROWS ( FILTER ( __Table, [Datastores.1.1] <> "N/A" ) )
Storage Array =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
CONCATENATEX ( FILTER ( __Table, [Datastores.1.1] <> "N/A" ), [Datastores.1.1], "," )
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.
@ThxAlot that was my first recommendation in my reply.
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.
Isn't it enough simple after you unpivot the table?
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Thanks for the response. I am very new to Powerbi and not good with the unpivot option, I will take a look. Thank you for the suggetion.
@Saul_K Usually you want unpivoted data but with the current structure, you can add the following two measures to get the result;
Storage Count =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
COUNTROWS ( __Table )
Storage Array =
VAR __Table =
DISTINCT (
UNION (
VALUES ( 'Storage'[Datastores.1.1] ),
VALUES ( 'Storage'[Datastores.2.1] ),
VALUES ( 'Storage'[Datastores.3.1] ),
VALUES ( 'Storage'[Datastores.4.1] ),
VALUES ( 'Storage'[Datastores.5.1] ),
VALUES ( 'Storage'[Datastores.6.1] ),
VALUES ( 'Storage'[Datastores.7.1] ),
VALUES ( 'Storage'[Datastores.8.1] )
)
)
RETURN
CONCATENATEX ( __Table, [Datastores.1.1], "," )
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.
Thanks a lot , that helps . I am very new to power bi and my questions may feel silly 🙂 I have one more ask,how we can ignore 'Null' / 'N/A' values when you run the above query ? I had null values before, but I changed it to N/A.
The below is the sample table.
As there is N/A value in most of the row, it calculate that as a value and add it in to count and storage array output.
Server_Name | No_of_Storage_connected | StorageArray |
VM1 | 2 | PureStorage05 ,PureStorage02 |
VM2 | 3 | PureStorage05 ,PureStorage02,N/A |
VM3 | 4 | InfiniStorage09,PureStorage06,PureStorage01,N/A |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
76 | |
65 | |
52 | |
51 |
User | Count |
---|---|
127 | |
116 | |
78 | |
64 | |
63 |