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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

If statement help

Trying to create a measure that write a statement that says "If the year is 2021, then divide by 5 and multiply by 12, if not then do nothing.

 

I wrote the below statement but I keep getting the error "A single value for column 'Year' in table 'Img Div_Img' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."

 

My table is named 'Img Div_Img' and the column identifying the year is labeled 'Year'

 

Charge count is formatted at a whole number and Year is formatted as text

 

2021 Anlzd = IF('Img Div_Img'[Year] = 2021,SUMX('Img Div_Img','Img Div_Img'[Charge Count]/5*12),"")
 
 
TIA!!
1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous if you are adding a column, do this:

 

2021 Anlzd = IF('Img Div_Img'[Year] = 2021,DIVIDE('Img Div_Img'[Charge Count],5)*12))

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@Anonymous if you are adding a column, do this:

 

2021 Anlzd = IF('Img Div_Img'[Year] = 2021,DIVIDE('Img Div_Img'[Charge Count],5)*12))

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

selimovd
Super User
Super User

Hey @Anonymous ,

 

you always have to check for aggretated values. So also for the year.

Check if the following works:

2021 Anlzd =
IF(
    MAX( 'Img Div_Img'[Year] ) = 2021,
    SUMX(
        'Img Div_Img',
        'Img Div_Img'[Charge Count] / 5 * 12
    ),
    ""
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.