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
Kella
Frequent Visitor

DAX Measure - To get only one value for multiple rows

I am new to Power BI, I am facing issue where I want to create a new column based on the Invoice Date and the Invoice No.
In below table, I want to calculate "What I want" column using DAX​ measure to get $35 for each Invoice No and displaying values ($35) for any rows.


Invoice No   Invoice Date SKU   Invoice    What I want
1001    7/12/2022 a123  $250    $35
1001    7/12/2022 b123  $100 
1001    7/12/2022 c123  $10 
1002    6/6/2023 z123  $2    $35
1002    6/6/2023 y123  $4 
1023    1/4/2023 k123  $1    $35
1023    1/4/2023 v123  $1,00 
1023    1/4/2023 s123  $5 
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

sum Invoice = SUM('Table'[Invoice])


-----
35 in Invoice = 
 
VAR _t1 = SELECTEDVALUE('Table'[Invoice No])
VAR _t2 = SELECTEDVALUE('Table'[Invoice Date])
VAR _tbl = FILTER(ALL('Table'),'Table'[Invoice No]=_t1&&'Table'[Invoice Date]=_t2)
VAR Results= RANKX(_tbl,[sum Invoice],,DESC)
RETURN
IF(Results =1,35)

 

Screenshot_3.pngScreenshot_2.png 

View solution in original post

5 REPLIES 5
Ahmedx
Super User
Super User

pls try this

sum Invoice = SUM('Table'[Invoice])


-----
35 in Invoice = 
 
VAR _t1 = SELECTEDVALUE('Table'[Invoice No])
VAR _t2 = SELECTEDVALUE('Table'[Invoice Date])
VAR _tbl = FILTER(ALL('Table'),'Table'[Invoice No]=_t1&&'Table'[Invoice Date]=_t2)
VAR Results= RANKX(_tbl,[sum Invoice],,DESC)
RETURN
IF(Results =1,35)

 

Screenshot_3.pngScreenshot_2.png 

Ahmedx
Super User
Super User

pls try this

Column = 
VAR _t1 = [Invoice No]
VAR _t2 = [Invoice Date]
VAR _tbl = FILTER(ALL('Table'),[Invoice No]=_t1&&[Invoice Date]=_t2)
VAR Results= RANKX(_tbl,[Invoice],,DESC)
RETURN
IF(Results =1,35)

Screenshot_1.png

Kella
Frequent Visitor

Thanks, @Ahmedx for your time. I think DAX you share is for the calculated column. I'm looking for a DAX measure to manage this.

Ritaf1983
Super User
Super User

Hi @Kella 

If i understood you correctly just add column with value you need an format it as currency:

Ritaf1983_0-1689906799264.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Thanks for your time but I need $35 to display for each Invoice No not for each row.

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.