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
Anonymous
Not applicable

Calculated column ..**Its urgent PLz****

Hi All, 

 

Below is my table with data 

ProductTypeSales
penA7
PenA9
PenB7
PenB4
PenB10
PenB5
PenB8
PenC4
PenC4
RubberA2
RubberB2
RubberE4
RubberD4
RubberE10
ScaleA10
ScaleA4
ScaleA7
ScaleA3
ScaleB1
ScaleB7
ScaleC1
ScaleC1
ScaleD4
ScaleE8
ScaleE5

 

Output 

TypeObsRuledPinned
A826
B6.8  
C   
D   
E   

 

need to calcualte the avg for each product and type .. In Obs we calculate for pen , ruled for rubber and pinned for scale . i need this to be displayed in table  not matrix table. 

is there any possible to get the dax as calculated column rather than measure . 

for ex:

in the obs for type A 

there are 2 pens for type A ,so the avg is 8 .

5 REPLIES 5
Anonymous
Not applicable

This might help, write following DAX measures:

Amount=SUM([Values])

NumOfDistinctDates=DISTINCTCOUNT([Date])

Avg=DIVIDE([Amount],[NumOfDistinctDates])

Razwan
Helper I
Helper I

@Anonymous 
Hi,
Why do you need a calculated column if a measure is more suitable in this situation?
Also, do you already have a table with distinct Type values or you need to create one like the Output?

HotChilli
Super User
Super User

Create a table as follows

TableAv = SUMMARIZECOLUMNS(TableXX[Type], "Obs", CALCULATE(AVERAGE(TableXX[Sales]), TableXX[Product] = "Pen") ,
                                          "Ruled" , CALCULATE(AVERAGE(TableXX[Sales]), TableXX[Product] = "Rubber"),
                                          "Pinned", CALCULATE(AVERAGE(TableXX[Sales]), TableXX[Product] = "Scale"))
Anonymous
Not applicable

Thnks for ur reply ..

 

i have a filter with pen,rubber,scale .. so when i select the pen .. in the table only pen dax should excute or come . so when i select rubber & pen , in the table both rubber and pen data should come in column .. 

can you help out with this .. 

Hi @Anonymous ,

 

According to your description, what you want to achieve is to dynamically add or delete columns according to slicer.

After the table is created according to @HotChilli  said before, you can refer to using-a-slicer-to-show-different-measures.

 

Best Regards,
Liang
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.