Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Isidro
Helper IV
Helper IV

Create a table with a different measure for each row

Hello,

 

I would like to create a table with a different measure for each row, like the following table:

 

CATEGORYAMOUNT
Category 1Measure 1
Category 2Measure 2
Category 3Measure 3
Category 4Measure 4
Category 5Measure 5
Category 6Measure 6



Is this possible to do? If it is possible, how could he do it?

 

Thank you very much and best regards.

2 ACCEPTED SOLUTIONS
Salvador
Responsive Resident
Responsive Resident

Hi,

 

With "If" statements? (if category = category 1; measure 1; if cat= cat 2.... etc)

View solution in original post

v-ljerr-msft
Employee
Employee

Hi @Isidro,

 

In addition, you should also be able to use SWITCH function in this scenario. The formula below is for your reference. Smiley Happy

AMOUNT =
IF (
    HASONEVALUE ( 'Table1'[CATEGORY] ),
    SWITCH (
        VALUES ( 'Table1'[CATEGORY] ),
        "Category 1", [measure1],
        "Category 2", [measure2],
        "Category 3", [measure3],
        "Category 4", [measure4],
        "Category 5", [measure5],
        "Category 6", [measure6],
        0
    )
)

 

Regards

View solution in original post

7 REPLIES 7
v-ljerr-msft
Employee
Employee

Hi @Isidro,

 

In addition, you should also be able to use SWITCH function in this scenario. The formula below is for your reference. Smiley Happy

AMOUNT =
IF (
    HASONEVALUE ( 'Table1'[CATEGORY] ),
    SWITCH (
        VALUES ( 'Table1'[CATEGORY] ),
        "Category 1", [measure1],
        "Category 2", [measure2],
        "Category 3", [measure3],
        "Category 4", [measure4],
        "Category 5", [measure5],
        "Category 6", [measure6],
        0
    )
)

 

Regards

Hi @v-ljerr-msft,

 

If I understand correctly, the amount formula you are doing is creating a column, but my question is how to create the table with the Category column.

 

Thank you and best regards.

Hi @Isidro,

 

Where is the Category column from? Is it a column of one of your table in your mode?

 

If that is the case, you can firstly use the the formula below to create a measure.

Measure1 =
IF (
    HASONEVALUE ( 'CatagoryTable'[Catagory] ),
    SWITCH (
        VALUES ( 'CatagoryTable'[Catagory] ),
        "Category 1", [measure1],
        "Category 2", [measure2],
        "Category 3", [measure3],
        "Category 4", [measure4],
        "Category 5", [measure5],
        "Category 6", [measure6],
        0
    )
)

Then you should be able to use the formula below to create the table with the Category column. Smiley Happy

Table = SUMMARIZE ( 'CatagoryTable', 'CatagoryTable'[Catagory], "Amount", [Measure1] )

 

Regards

Thank you, 

you REALLY helped me

When i am trying to create the table as you have mentioned I am getting below error. Please help...

 

"The function SUM cannot work with values of type String."

Can you please attach the sample PBI which I can refer this?

 

I am trying to create the table as in below post. Is that possible with the above code? Please guide me..

 

https://community.powerbi.com/t5/Desktop/How-to-create-several-independent-calculations-over-differe...

 

Salvador
Responsive Resident
Responsive Resident

Hi,

 

With "If" statements? (if category = category 1; measure 1; if cat= cat 2.... etc)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.