The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello Good People!
Can you help to figure out how to create the Min Value in a column - taking the small value of a data?
Example: In Soccer Value: 2 - In Baseball Value: (repeated in all rows the last Value)
Sport | Value |
Socccer | 2 |
Socccer | 3 |
Socccer | 4 |
Socccer | 4 |
Baseball | 4 |
Baseball | 4 |
Baseball | 1 |
Baseball | 3 |
Baseball | 6 |
Solved! Go to Solution.
Hi @AllanArayita ,
The Table data is shown below:
Please follow these steps:
1.Add an index column after grouping by column 'Sport' in Power query.
Table.AddIndexColumn([Count],"Index",1)
2.Use the following DAX expression to create a column
Column =
SWITCH(TRUE(),
[Sport] = "Socccer", CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Sport])),
[Sport] = "Baseball",
VAR _maxIndex = CALCULATE(MAX('Table'[Index]),ALLEXCEPT('Table','Table'[Sport]))
RETURN CALCULATE(MAXX(FILTER('Table',[Index] = _maxIndex),[Value]),ALLEXCEPT('Table','Table'[Sport]))
)
3.Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @AllanArayita ,
The Table data is shown below:
Please follow these steps:
1.Add an index column after grouping by column 'Sport' in Power query.
Table.AddIndexColumn([Count],"Index",1)
2.Use the following DAX expression to create a column
Column =
SWITCH(TRUE(),
[Sport] = "Socccer", CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Sport])),
[Sport] = "Baseball",
VAR _maxIndex = CALCULATE(MAX('Table'[Index]),ALLEXCEPT('Table','Table'[Sport]))
RETURN CALCULATE(MAXX(FILTER('Table',[Index] = _maxIndex),[Value]),ALLEXCEPT('Table','Table'[Sport]))
)
3.Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
11 | |
9 | |
8 |