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
Unmake
Regular Visitor

Group by text measures

I have two fact tables (sales and remnants) and two dimention tables (articles and time).

 

I calculate a text measure at articles table. It simple meaning:

 measure  = if(sum(sales)-sum(remnants)>0:"type1";"type2")

When i change date period on dateslicer  - value of my measure changes - it's ok.

But i dont understand how can i calculate how much articles have "type1" and how much have "type2" and how can i visualize this. 
+ need to calculate sum(remnants) by measure

I hope you help me! 🙂

1 ACCEPTED SOLUTION

Hi @Unmake,

 

It is not available to achieve your expected result exactly. We cannot summarize table based on a single measure, because different from a column, measure only returns a signle value without context. To make measure display a list of values, we should add a conext column in table visual.

 

Suppose table structure is like:

3.PNG

 

Please create measures similar to:

sales total = SUM(Sales[Sales]) 
remnants total = SUM(remnants[Remnants])

Type = if([sales total]-[remnants total]>0,"type1","type2")

Count articles =
IF (
    [Type] = "type1",
    CALCULATE (
        COUNT ( articles[ArticleID] ),
        FILTER ( ALL ( articles ), [Type] = "type1" )
    ),
    CALCULATE (
        COUNT ( articles[ArticleID] ),
        FILTER ( ALL ( articles ), [Type] = "type2" )
    )
)

Result.

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

If all of your tables are linked correctly via the Relationships area of Power BI, you could make use of a Table or Matrix visual to do this.

 

For example, create a table visual and make the first field Articles.  This will mean that you get 1 row for each article.

Next field you want is the field that contains the data of whether it is Type 1 or Type 2.  From here, you will get 1 row for each Type each article has.

Lastly, make the 3rd field remenants.  Set this to summarise as Count.

 

Does this give you what you were after?

 

No, this way leads to summarise by article, but i need summarise  by measure.

Expected Result:

[type]   [count_articles]  [sum]

 

type1   111                     2323 $

type2   50                       70$

Anonymous
Not applicable

What happens if you make a table exactly as you have shown in your reply?  First field Type, second field Articles (summaried as count), and third the value column you are expecting summaried as a sum? (you can use the same column multiple times) 

i cant move measure as row 😞 its main problem

Hi @Unmake,

 

It is not available to achieve your expected result exactly. We cannot summarize table based on a single measure, because different from a column, measure only returns a signle value without context. To make measure display a list of values, we should add a conext column in table visual.

 

Suppose table structure is like:

3.PNG

 

Please create measures similar to:

sales total = SUM(Sales[Sales]) 
remnants total = SUM(remnants[Remnants])

Type = if([sales total]-[remnants total]>0,"type1","type2")

Count articles =
IF (
    [Type] = "type1",
    CALCULATE (
        COUNT ( articles[ArticleID] ),
        FILTER ( ALL ( articles ), [Type] = "type1" )
    ),
    CALCULATE (
        COUNT ( articles[ArticleID] ),
        FILTER ( ALL ( articles ), [Type] = "type2" )
    )
)

Result.

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.